cmd: echo %path%, echo %COMMANDER_PATH% returns nothing

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
JimmyTheBroker
Member
Member
Posts: 179
Joined: 2017-06-07, 05:22 UTC

cmd: echo %path%, echo %COMMANDER_PATH% returns nothing

Post by *JimmyTheBroker »

Hi guys,

I'm a little newish to DOS and command prompt but have made a few batch files.

I know that opening command prompt and echo %path% will return the environmental variables of PATH (the locations that are associated with it)

Im wondering why doesn't echo %COMMANDER_PATH% return anything?


Thanks,
Jimmy
8)
I finally get notifications from emails again!!!
So happy!
User avatar
JimmyTheBroker
Member
Member
Posts: 179
Joined: 2017-06-07, 05:22 UTC

Post by *JimmyTheBroker »

The reason why i'm interested in this is because I am moving the totalcmd directory around from device to device and from hard-drive to hard-drive.

windows10 Taskbar shortcut:
"C:\Program Files (x86)\totalcmd\TOTALCMD64.EXE"
which no longer works if I create a new copy in another location and delete the original copy.

I had hoped that if I made the windows10 Taskbar shortcut:
"%path%\totalcmd\TOTALCMD64.EXE"
it would search all the path locations, checking until it found TOTALCMD64.EXE and then open that.

Does anyone if this is possible, or a better solution?

I *think I might*, be able to do something like this using a batch file but that seems like a lot of work for something that should already exist.

Let me know what you think,

Jimmy
I finally get notifications from emails again!!!
So happy!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

echo %COMMANDER_PATH%
does return something, but ONLY if you open cmd.exe from within Total Commander.

Why?
%COMMANDER_PATH% isn't defined in the system, because you could have multiple running Commanders from different directories at the same time. Total Commander sets it at runtime in its own process. When you start a process like cmd.exe, it inherits these variables from the program which started it.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Im wondering why doesn't echo %COMMANDER_PATH% return anything?
It will only show the path if TC is runing and you run the command from a command prompt that is started from TC.
I had hoped that if I made the windows10 Taskbar shortcut:
"%path%\totalcmd\TOTALCMD64.EXE"
it would search all the path locations, checking until it found TOTALCMD64.EXE and then open that.
You cannot use %path% this way - %path% is a list of paths, you cannot just append anything to that list in the way you tried. You could add c:\totalcmd\ permanently to the %path% (see * below), and then just write TOTALCMD64.EXE in the Target field, but the problem is that Windows will automatically insert c:\totalcmd\ in front of TOTALCMD64.EXE when you close the shortcut properties dialog.

You can make environtment variables work in a shortcut like this:
1. Run SystemPropertiesAdvanced.exe
2. Click on the button "Environment Variables..."
3. In the top of the dialog click the "New..." button
4. For Variable name enter somthging unique - like MY_TC
5. For Variable value enter the physical path to TC executable (for example c:\totalcmd\totalcmd64.exe)
6. Press OK 2 times.

Now you can change the shortcut Target to: %MY_TC%

Unfortunately environment variables does not work in Windows' Taskbar, although it works for Desktop shortcuts. So you cannot use it in the Taskbar.

* If you want to add c:\totalcmd\ to the %path% variable, use SystemPropertiesAdvanced.exe and then find and edit the PATH in the bottom of the dialog.

But why don't you just enter the proper path in your shortcut?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply