How do I run a .exe file from the command prompt?
For example, if the .exe file is located at C:\file.exe
, how do I run this file when the prompt is currently in another location like D:\
?
command linewindows
How do I run a .exe file from the command prompt?
For example, if the .exe file is located at C:\file.exe
, how do I run this file when the prompt is currently in another location like D:\
?
Best Answer
You can either run it by using the explicit path:
or add its location to the path (I always have a c:\bin directory to hold my little snippets - not really a kosher location for multiple-user Windows, but none of my Windows installs are multiple-user):
Note that, with that second solution, you should be setting up your path so that it's available whenever you start up (in autoexec.bat if you're really using DOS or from the
Control Panel -> System -> Environment
window if you're using Windows).And, do note that, if you use the control panel solution, that doesn't affect currently open command windows - you'll need to shut them down and re-open to pick up the new environment variable.