The type command, in Linux, returns the location, on the filesystem, of the given file, if it is in the current folder or the $PATH. This functionality is also available through Windows with the Git Bash command line program. The command also returns a file's location given the file without its extension (.exe, .vbs, etc.) However, I have run into what seems like a strange corner case where the file exists on the $PATH but doesn't get returned using the command.
I am thinking of buying a new computer soon, so I looked up the method of transferring the license key from one computer to another, in preparation for actually doing this. The method I found mentioned the files slmgr.vbs and slui.exe, both of which reside in the C:/Windows\System32 folder, which is in my $PATH, as usual for a Windows computer. However, these two files aren't showing up when I use the type command. Also, neither gets executed when I call the files as commands without their extensions in Git Bash, and only slmgr.vbs gets executed when I call them with the extensions. Finally, slmgr.vbs is shown when listing the folder's contents in Git Bash, as well, but slui.exe isn't.
I thought this might have to do with permissions, and, indeed, both files have very restrictive permissions, as you can see in the pictures below, but they both have the same permissions, which wouldn't explain why one gets executed and the other doesn't when called directly, nor why one file is listed on command line but the other isn't.
C:\Windows\System32 folder, proving the files exist:
File permissions for the Users and Administrators groups for the two files (they are identical):
And the folder:
type command and its output in Git Bash for the 2 files, plus listing the files in the folder (using grep to filter as the folder is huge), as well as listing part of the $PATH (keep in mind, for all these, that Git Bash changes the paths as they are displayed):
$ type -a slmgr
sh.exe": type: slmgr: not found
$ type -a slmgr.vbs
sh.exe": type: slmgr.vbs: not found
$ type -a slui
sh.exe": type: slui: not found
$ type -a slui.exe
sh.exe": type: slui.exe: not found
sh.exe": slmgr: command not found
/c/WINDOWS/system32/slmgr.vbs: line 2: syntax error near unexpected token `('
/c/WINDOWS/system32/slmgr.vbs: line 2: `' Copyright (c) Microsoft Corporation. A
ll rights reserved.'
sh.exe": slui: command not found
sh.exe": slui.exe: command not found
$ ls /c/Windows/System32/slui.exe /c/Windows/System32/slmgr.vbs
ls: /c/Windows/System32/slui.exe: No such file or directory
$ echo $PATH
Files (x86)/Intel/iCLS Client/:/c/Program Files/Intel/iCLS Client/:/c/WINDOWS/sy
/v1.0/:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Progr
am Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files (x86)/
Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Int
el(R) Management Engine Components/IPT:/c/Program Files/Intel/WiFi/bin/:/c/Progr
am Files/Common Files/Intel/WirelessCommon/:/c/strawberry/c/bin:/c/strawberry/pe
rl/site/bin:/c/strawberry/perl/bin:/c/Program Files (x86)/Microsoft ASP.NET/ASP.
NET Web Pages/v1.0/:/c/Program Files/Microsoft SQL Server/110/Tools/Binn/:/c/Pro
gram Files (x86)/Microsoft SQL Server/90/Tools/binn/:/c/Program Files (x86)/Open
AFS/Common:/c/HashiCorp/Vagrant/bin:/c/Program Files (x86)/Windows Kits/8.1/Wind
ows Performance Toolkit/:/c/Program Files/nodejs/:/c/Program Files (x86)/Git/cmd
:/c/Program Files (x86)/Git/bin:/c/Program Files/Microsoft/Web Platform Installe
r/:/c/Ruby200-x64/bin:/c/Users/Sean/AppData/Local/Box/Box Edit/:/c/Program Files
(x86)/SSH Communications Security/SSH Secure Shell:/c/Users/Sean/Documents/Lisp
/VirtualBox:/c/Program Files/Java/jdk1.7.0_51/bin:/c/Program Files/Node-Growl:/c
/chocolatey/bin:/c/Program Files/eclipse:/c/MongoDB/bin:/c/Program Files/7-Zip:/
c/Program Files (x86)/Google/Chrome/Application:/c/Program Files (x86)/LibreOffi
ce 4/program:/c/Program Files (x86)/OpenOffice 4/program
What's happening? Why aren't these files listed with the type command? Is this issue because of weird Windows permissions, or something even weirder? If permissions, why do they seem to have the same permissions, yet both are not handled in the same way?