cmd %PATH% ?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
brontosaurusrex
Junior Member
Junior Member
Posts: 16
Joined: 2021-01-01, 17:56 UTC

cmd %PATH% ?

Post by *brontosaurusrex »

Assuming my dir structure is

Code: Select all

totalcmd
    - totalcmd stuff
bat
    - myBatFile.bat
and when I start cmd.exe from one of the buttons, what are my chances that stuff in 'bat' dir will be visible as if on path?

As if

Code: Select all

set PATH=%PATH%;%COMMANDER_PATH%\..\bat\
was run. (edit: I guess I could just stick this to the top of each bat script)

In other words, I'd like NOT to use stuff like this in bat scripts

Code: Select all

%COMMANDER_PATH%\..\bat\SearchAndReplace
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Re: cmd %PATH% ?

Post by *wanderer »

Hi. You can add this path to system environment settings. Not in front of a pc now, so can't help any more atm.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: cmd %PATH% ?

Post by *Stefan2 »

Or just use
CD ..\bat\
in first line of your batch.

If need, you can also use PUSHD command to go forth and back in path history:
https://en.wikipedia.org/wiki/Pushd_and_popd


Or maybe you can use %COMMANDER_DRIVE%
https://www.ghisler.ch/wiki/index.php/Navigation





 
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Re: cmd %PATH% ?

Post by *wanderer »

wanderer wrote: 2021-01-03, 15:31 UTC Hi. You can add this path to system environment settings. Not in front of a pc now, so can't help any more atm.
If you really need this and Stefan's suggestion does not cover your needs, go to windows Search and type "edit environment variables for your account". In there, find the "PATH" environment variable and add your path. Be very careful though not to accidentally alter or delete any of the other paths because there may be unforeseen consequences.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
nsp
Power Member
Power Member
Posts: 1805
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: cmd %PATH% ?

Post by *nsp »

If you want to have it in the path just add it in the path ! ;)

If you use TC from a single location then it is better to add your batch folder in the path system wide. I can advise you to use RapidEE for environment variable edition.

The variable commander_path is created once total commander is launched. So if you want to use it, you will have to set your path from TC process or sub processes. To do it from TC only once, IMO the best is to install AutoRun plugin and alter the PATH variable as you described using the ability to set env variable from autorun. The installation of autorun is a bit more complicated than usual content plugin. Just read and follow instructions of the help file.
User avatar
brontosaurusrex
Junior Member
Junior Member
Posts: 16
Joined: 2021-01-01, 17:56 UTC

Re: cmd %PATH% ?

Post by *brontosaurusrex »

Thanks everyone, until the amount of batch files is small, I will live with adding

Code: Select all

set PATH=%PATH%;%COMMANDER_PATH%\..\bat\
on top of every script, will reevaluate when/if it gets more complicated.
User avatar
brontosaurusrex
Junior Member
Junior Member
Posts: 16
Joined: 2021-01-01, 17:56 UTC

Re: cmd %PATH% ?

Post by *brontosaurusrex »

Stefan2 wrote: 2021-01-03, 20:01 UTC Or just use
CD ..\bat\
in first line of your batch.
Is that any different than the button that call the script with '%COMMANDER_PATH%\..\bat\' as 'start path'?
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: cmd %PATH% ?

Post by *Dalai »

I'm wondering what your goal is. Why do you need to working directory (start path) set? If you need to get the absolute directory of the currently running script, you can just use

Code: Select all

%~dp0
as reference.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
brontosaurusrex
Junior Member
Junior Member
Posts: 16
Joined: 2021-01-01, 17:56 UTC

Re: cmd %PATH% ?

Post by *brontosaurusrex »

@Dalai, thanks, noted (forgot about that one).

Goal is to have a folder structure ready for action that can be copy/pasted from machine to machine (perhaps even synced, perhaps synced via git). So the 'user' must only supply total commander to specific folder. Also minimum or better yet none changes to the windows itself.

The other part of the puzzle is to have start menu command or buttons which will start specific bash scripts inside wsl/Debian (not relevant to this thread).
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: cmd %PATH% ?

Post by *MVV »

Autorun plugin mentioned by nsp is a perfect place to add custom paths to TC's PATH variable that will be passed to all child processes.
Post Reply