The PATH variable does not support wildcards or recursion. This is by design.
There are two possible workarounds that I've used on occasion:
Create a directory with simple batch files and add that directory to the PATH. Each batch file can launch the program you want, for example:
:: CMD_Software.bat: start CMD_Software
@C:\Users\myuser\CMD_Software\CMD_Software.exe %*
The first line is a comment, the second starts with @
to avoid showing the command being run, and %*
is used to pass any command line arguments to the EXE.
Add aliases to CMD.EXE:
DOSKEY CMD_Software="C:\Users\myuser\CMD_Software\CMD_Software.exe" $*
This essentially translates CMD_Software
in the command prompt to everything after the equal sign. The $*
is replaced with the supplied arguments.
I prefer the second approach, because you can group all the aliases in a single file (see the "/MACROFILE" switch in DOSKEY /?) and have it autorun whenever the command interpreter starts using a registry setting (see "AutoRun" key in CMD /?).
A drawback of the second method is that aliases work only at the start of a command line. This can be a problem if you want to chain commands. For example, CLS & CMD_Software
won't work unless you put the alias in a separate line using parentheses:
CLS & (
CMD_Software
)
Whenever this becomes a problem, I just fallback to the batch file approach.
Did you try something like
C:\Users\myuser\CMD_Software\*\
? – terdon – 2013-03-21T16:18:02.9434I don't think this is possible. – Harry Johnston – 2013-03-22T02:22:34.927