Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Register" an .exe so you can run it from any command line in Windows

Tags:

windows

How can you make a .exe file accessible from any location in the Windows command window? Is there some registry entry that has to be entered?

like image 726
HK1 Avatar asked Oct 20 '22 07:10

HK1


People also ask

How do I run an EXE from command line arguments in Windows?

You can test command line arguments by running an executable from the "Command Prompt" in Windows or from the "DOS prompt" in older versions of Windows. You can also use command line arguments in program shortcuts, or when running an application by using Start -> Run. This will start notepad with a blank document.

Can you run an EXE from cmd?

Type "start [filename.exe]" into Command Prompt, replacing "filename" with the name of your selected file. Replace "[filename.exe]" with your program's name. This allows you to run your program from the file path.


2 Answers

You need to make sure that the exe is in a folder that's on the PATH environment variable.

You can do this by either installing it into a folder that's already on the PATH or by adding your folder to the PATH.

You can have your installer do this - but you may need to restart the machine to make sure it gets picked up.

like image 148
ChrisF Avatar answered Oct 21 '22 20:10

ChrisF


Windows 10, 8.1, 8

Open start menu,

  1. Type Edit environment variables
  2. Open the option Edit the system environment variables
  3. Click Environment variables... button
  4. There you see two boxes, in System Variables box find path variable
  5. Click Edit
  6. a window pops up, click New
  7. Type the Directory path of your .exe or batch file ( Directory means exclude the file name from path)
  8. Click Ok on all open windows and restart your system restart the command prompt.
like image 128
AmiNadimi Avatar answered Oct 21 '22 19:10

AmiNadimi