You might try %@PIDCOMMAND[%_PPID]
This seems to be working for what I'm looking to do. Basically I want to set prompt to Desktop unless a directory is requested when TCMD is being invoked. Multiple instances are allowed.
In tcstart.btm I have:
Code:
@ECHO OFF
prompt = $e[30;46;2m[$w]$e[40;36;1m$s[$t$h$h$h]#$e[40;37;2m$s
alias /R "c:\Users\Ville\My Documents\TCMD\aliases.tcmd"
path %path;%ProgramFiles(x86)\bind\
set startcommand=%@pidcommand[%_PPID]
set startdir=%@TRIM[%@word[2,%startcommand]]
msgbox ok "startcomand" startcommand is '%startcommand'
msgbox ok "startdir" startdir is '%startdir'
if %startdir == "" cdd desk:
cdd /to .
cls
Now this works in all cases except when I'm invoking TCMD from
Launchy. It doesn't provide any command line parameters; startdir is empty (''), but still
cdd desk: is not called, and since no command line directory is requested, TCC opens in c:\Program Files (x86)\TCMD\
Any idea why
if %startdir == "" cdd desk: fails when startdir is blank, but only when started from Launchy? I tried to check it also with DEFINED, but it didn't help (I suppose it's always set since I use
set startdir= ...).
Contents of startcommand and startdir are identical whether started from the Start menu icon or from Launchy, but the end result is different.
I'm using
cdd /to . in the end because when the directory is requested (when selecting "TCMD prompt here"), the correct folder is highlighted in the GUI, but it may not be scrolled in the view if the current directory listing is long.