Buttons and _cwd

Feb 25, 2010
5
0
#1
I am once again confused about the (relatively) new style of buttons in Take Command. In TCMD 11 when I run the command "cdd /t %_cwd" the result is what I intend, namely to switch the folder view's current directory to the same as the command window's. When I insert it into a button, however, _cwd always expands to the directory in which Take Command is installed. For example, if I say "cdd c:\" with the expected result then click on my button, it inserts the command "cdd c:\apps\tcmd11" onto the command line. If the button says '"cdd /t %_cwd" enter' it immediately switches both views to the Take Command directory. What's going on here?
 
Feb 25, 2010
5
0
#2
Never mind, I've got it now. %_cwd puts the value of the variable on the command line, whereas %%_cwd puts the string %_cwd on the command line which gets expanded upon execution. It's still not clear to me where _cwd is getting the values assigned to it using just one "%", but two works.

It occurred to me while working in the button dialog box that checking the "change folder directory" and not passing any command at all might do what I wanted, but it doesn't. I have no idea what it does do.

What would really be useful is if clicking on the folder view changed the working directory of the command window, without dragging/dropping or worrying about what's already on the CL. Is that doable, desirable, or useful to anyone else?
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#3
Never mind, I've got it now. %_cwd puts the value of the variable on the command line, whereas %%_cwd puts the string %_cwd on the command line which gets expanded upon execution. It's still not clear to me where _cwd is getting the values assigned to it using just one "%", but two works.
If you have a single %, it gets expanded immediately inside TCMD, and it will be assigned TCMD's current directory (which is probably not the same as TCC's current directory).

What would really be useful is if clicking on the folder view changed the working directory of the command window, without dragging/dropping or worrying about what's already on the CL. Is that doable, desirable, or useful to anyone else?
It's not doable for anything other than a TCC tab window, and is problematic even there as some operations will not be happy to have the current directory changed unexpectedly.