Detecting command line application from CMD without using PATH or System32 / SysWow64 function

Scenario

I would like to install the x86 CommandLine application in a folder outside C:\Windows\System32

or C:\Windows\Syswow64

and still be able to access my application in CMD without adding my program path inside an environment variable PATH

.

Question

Can this be done? Possibly related to required registry keys?

Note. I know how to add my application to PATH

variable / regvalue or how to access my application from CMD by putting the required .exe file in the System32

/ folder SysWow64

. This question is only about exploring alternatives so as not to solve problems with PATH

or System dirs.

code

I tried this suggested approach from @ Sertac Akyuz's comment in this answer , I saved MyApp.exe

in the C:\

root directory but I cannot detect the application by just putting MyApp.exe

in 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"

      

+3


source to share


1 answer


App Paths

registry settings - used by Windows Explorer to search for programs when you type a program name in the Run ... field, and so on. These settings do not affect behavior cmd.exe

.



The only way to customize the cmd.exe

search paths for applications is to change the environment variable PATH

. You can run cmd.exe

from your own .bat

/ .cmd

, where you set all the required variables for the current session without changing it globally.

+5


source







All Articles