4

Scenario

I would like to install an x86 CommandLine application on a folder outside C:\Windows\System32 or C:\Windows\Syswow64 and still be able to access my app under CMD without adding my application's path inside the PATH environment variable.

Question

Is this possible to do? Maybe touching a needed registry keys?

Note: I know how to add my application into PATH variable/regvalue or how to access my application from CMD putting the required .exe in the System32/SysWow64 folder. This question is only to learn alternatives, it's not to solve issues with PATH or System dirs.

Code

I've tried this suggested approach from a comment of @Sertac Akyuz in this answer, I have stored MyApp.exe on C:\ root directory, but I can't detect the application just putting MyApp.exe under the CMD.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe]
@="C:\\MyApp.exe"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe]
@="C:\\MyApp.exe"

[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe]
@="C:\\MyApp.exe"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe]
@="C:\\MyApp.exe"
Community
  • 1
  • 1
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
  • App Paths does not apply for command prompt. But you can cheat with App Paths registry. You can create an entry for `cmd.exe` itself and create there the `Path` key value with the path to your app. Path from this key value is then appended to the environment variable of the application (in this case the command prompt). – TLama Nov 28 '14 at 00:26
  • FYI: App Paths is not used by cmd.exe but is used by other shells, for example tcc.exe: http://jpsoft.com/tccle-cmd-replacement.html – Simon Mourier Nov 28 '14 at 06:16
  • If you want to run from command line an application that has been included in `App Paths`, you need to use `start MyApp`. – MC ND Nov 28 '14 at 07:24
  • I'm finding the question a bit odd, as I don't understand what exact problem you are wanting to solve. You just want the command to be runnable from any CMD prompt, but without altering PATH ? There's plenty of methods. First one : provide the full path of the exectuable. If you don't want to change PATH, what else do you expect ? Maybe check if you can use aliassing (similar to Linux/Unix). Or shortcuts, scripts, ... – tvCa Dec 16 '14 at 17:24

1 Answers1

5

App Paths registry settings - used by Windows Explorer, to locate programs when you type program name in "Run..." box, and so on. These settings are not affecting cmd.exe behavior.

The only way to set up cmd.exe paths for searching applications is changing PATH environment variable. You can start cmd.exe from your own .bat/.cmd where you set up all required variables for current session, without changing it globally.

vitalyster
  • 4,980
  • 3
  • 19
  • 27