Register .exe so you can run it from any command prompt on Windows

How can you make a .exe file accessible from anywhere in a Windows command window? Should a registry entry be entered?

+136
windows
Jan 27 2018-11-21T00:
source share
16 answers

You need to make sure that exe is in the folder that is in the PATH environment variable.

You can do this by setting it to a folder that is already on PATH , or adding your folder to PATH .

You may have your installer, but you will need to restart your computer to make sure it is up.

+80
Jan 27 2018-11-22T00:
source share

You can add the following registry key:

 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\myexe.exe 

In this key, add the default string value containing the path to the exe file.

+44
Jan 27 2018-11-22T00:
source share

You must put your .exe file path in the environment variable path. Go to β€œMy Computer β†’ Properties β†’ Advanced β†’ Environment Variables β†’ Path” and edit the path by adding the .exe directory to the path.

Another solution that I personally prefer is to use RapidEE for smoother editing of variables.

+39
Jan 27 2018-11-23T00:
source share

Instead of putting the executable in a directory on the path, you should create a batch file in the directory on the path that starts the program. Thus, you do not separate the executable from its supporting files, and you do not inadvertently add other things to the same directory to the path.

Such a batch file might look like this:

 @echo off start "" "C:\Program Files (x86)\Software\software.exe" %* 
+28
Jan 27 '11 at 10:22
source share

Windows 10, 8.1, 8

Open the start menu,

  1. Type Edit environment variables
  2. Open the option Edit the system environment variables
  3. Click the Environment variables... button
  4. There you see two fields, in the System Variables window find the path variable
  5. Click Edit
  6. popup, click New
  7. Enter the directory of your .exe or batch file (the directory means to exclude the file name from the path)
  8. Click Ok in all open windows and reboot the system , restart the command line .
+23
Jan 27 '17 at 13:32
source share
  • If you want to run it in cmd.exe or batch files, you need to add the .exe directory to the% path% variable ( System or User )
  • If you want to run it in the Run dialog box (Win + R) or in any application that calls ShellExecute , adding your exe to the path to the application files is enough (it is less prone to errors during installation / uninstallation, and also does not clutter the variable ways)
+3
Jan 27 2018-11-11T00:
source share

It's amazing that there is no simple solution for such a simple task in windows, I created this little cmd script that you can use to define aliases in windows (instructions are in the file header itself):

https://gist.github.com/benjamine/5992592

this is almost the same approach used by tools like NPM or ruby ​​stones to register global teams.

+3
Nov 19 '13 at 19:36
source share

You can also permanently (after reboot) add this path to the Path variable:

Right-click My Computer β†’ Click Properties β†’ Select Advanced System Settings β†’ Environment Variables

Link: Change system / user variables

+3
Jul 15 '14 at 4:02
source share

Place it in the c: \ windows directory or add the directory to the "path" in the environment settings (window break - tab redone)

Regards, // t

+2
Jan 27 '11 at 22:01
source share

Use a 1 line batch file in your installation:

 SETX PATH "C:\Windows" 

run the bat file

Now put your .exe in c: \ windows and you're done.

you can enter "exename" on the command line and it will launch it.

+1
Mar 10 '15 at 17:45
source share

Simple Bash-Like Aliases on Windows

To get the global Bash aliases in Windows for applications that are not automatically added to the path without manually adding each of them, here is the cleanest solution that I came up with that makes the minimum number of changes to and has the maximum flexibility for subsequent configuration:

Set your alias path

 mkdir c:\aliases setx PATH "c:\aliases;%PATH%" 

Add your nickname

Open shell in a new window

To start C:\path to\my program.exe , passing all the arguments, opening it in a new window, create the file c:\aliases\my program.bat with the following contents (see NT Start Command for more information on the start command):

 @echo off start "myprogram" /D "C:\path to\" /W "myprogram.exe" %* 

Running in the current shell window

To start C:\path to\my program.exe , passing all the arguments, but running it in the same window (more similar to how bash works), create a file c:\aliases\my program.bat with the following contents:

 @echo off pushd "C:\path to\" "my program.exe" %* popd 

Run in window of current shell 2

If you do not need an application to change the current working directory in general to work, you can simply add a symbolic link to the executable file inside your aliases folder:

 cd c:\aliases\ mklink "my program.exe" "c:\path to\my program.exe" 
+1
Jun 16 '17 at 15:56 on
source share

Let's say my exe file is C: \ Program Files \ AzCopy \ azcopy.exe

Command / CMD / Batch

 SET "PATH=C:\Program Files\AzCopy;%PATH%" 

Powerhell

 $env:path = $env:path + ";C:\Program Files\AzCopy" 

Now I can just print and use azcopy from anywhere from any command line shell inc, powershell, git bash, etc.

+1
Aug 21 '19 at 11:30
source share

Add to PATH, steps below (Windows 10):

  1. Enter "environment ..." in the search bar and select "Change system environment variables", which opens the "System Properties" window
  2. Click the Environment Variables ... button.
  3. On the Environment Variables tab, double-click the Path variable in the System Variables section.
  4. Add the path to the folder containing the .exe file to the Path by double-clicking the blank line and pasting the path.
  5. Click OK and exit. Open a new cmd prompt and press a command from any folder and it should work.
0
Jul 02 '18 at 18:26
source share

Another way could be to add .LNK to your $ PATHEX. Then simply create a shortcut for your executable (i.e. yourshortcut.lnk) and place it in any of the directories listed in $ PATH.

ATTENTION NOTE: Be aware that any .lnk files located in any directories listed in your $ PATH are now also "PATH'ed". For this reason, I would prefer the batch file method mentioned earlier for this method.

0
Sep 09 '18 at 5:06
source share

If someone is looking for this after me, here is a very simple way to add your Path.

Send the path to the file as shown, copy and paste it from the file and add the specific path at the end with the previous semicolon to the new path. It may be necessary to get to windows 7, but at least it's a simple starting point.

Command line to export PATH to text file

-one
Apr 28 '16 at 17:06 on
source share

The best way to do this is to simply install the .EXE file in the windows / system32 folder. that way you can run it from anywhere. This is the same place where .exe, like ping, can be found

-3
Oct 20 '16 at 0:19
source share



All Articles