If I have an executable file called “test.exe”, in Command Prompt, the following command will invoke it:
However, if I have a shortcut to that same execute elsewhere called “test.lnk”, just typing “test” in Command Prompt doesn’t work. Instead I have to type:
Is there any way for me make test.lnk execute by just typing “test” in Command Prompt?
for a permanent change you may use this commands:
user-wide (for current user):
setx pathext %pathext%;.lnk
system-wide (for all users on the machine):
setx /m pathext %pathext%;.lnk
setx makes environment variable instead of session variable, which exists only in the
cmd.exe process where it is set
another solution is to use
mklink to create symlink (symbolic link) instead of shortcuts
mklink test.exe "c:program filesapplicationtest.exe"
symlinks don’t have
.lnk extension and size
after using the above mentioned
setx commands you can find your variables here in the environment variables window which can be displayed using this command:
setx is an external command, ie an executable file, which is located at
c:windowssystem32 folder by default, and thus may not exist in some versions or editions of windows
Add ;.LNK to the end of env var
PATHEXT. For a single instance of CMD, you can just
For a permanent change (all CMD going forward), find Advanced System Properties or Advanced System Settings, which occurs in different places on different Windows versions, click
Environment Variables and look under
System Variables (the bottom half).