Change directory with relative path
Moderators: Hacker, petermad, Stefan2, white
Change directory with relative path
Hi, I'm trying to find a method to change directory with relative path.
Is there an easy way?
I know if a run on the tab command line:
cd ..\..\mydir
it changes the current dir of that panel to mydir.
A possible solution would be to pass a cmd file to run like it is written directly on that command line.
Any ideas?
Thanks.
Is there an easy way?
I know if a run on the tab command line:
cd ..\..\mydir
it changes the current dir of that panel to mydir.
A possible solution would be to pass a cmd file to run like it is written directly on that command line.
Any ideas?
Thanks.
- sqa_wizard
- Power Member
- Posts: 3896
- Joined: 2003-02-06, 11:41 UTC
- Location: Germany
Just create a button at your buttonbar with this command.
Simply copy the below text and paste it at your buttonbar.
It will create an according button.
Simply copy the below text and paste it at your buttonbar.
It will create an according button.
Code: Select all
TOTALCMD#BAR#DATA
cd ..\..\mydir
%COMMANDER_PATH%\TOTALCMD.EXE,1
-1
#5767 Personal license
[quote="sqa_wizard"]Just create a button at your buttonbar with this command.
Simply copy the below text and paste it at your buttonbar.
It will create an according button.
[code]TOTALCMD#BAR#DATA
cd ..\..\mydir
%COMMANDER_PATH%\TOTALCMD.EXE,1
-1[/code][/quote]
Thanks for your answer, I understand what you mean, but what I want is something to do with a lot of directories, not just with one. I want this for my portable USB programs.
Simply copy the below text and paste it at your buttonbar.
It will create an according button.
[code]TOTALCMD#BAR#DATA
cd ..\..\mydir
%COMMANDER_PATH%\TOTALCMD.EXE,1
-1[/code][/quote]
Thanks for your answer, I understand what you mean, but what I want is something to do with a lot of directories, not just with one. I want this for my portable USB programs.
Hi, What I want is to create something like a shortcut with relative path to directories. That's not possible on Windows shortcuts, so I want to know if there's a way to do something similar with TotalCommander:
I'm in a directory ?:\portables\system\
and I want to change to ?:\portables\Internet\Hist\
double clicking on some kind of shortcut.
Thanks.
I'm in a directory ?:\portables\system\
and I want to change to ?:\portables\Internet\Hist\
double clicking on some kind of shortcut.
Thanks.
You can use internal cd command in buttonbar or in directory hotlist (Ctrl+D or asterisk button above panel).
If your portables folder is in drive's root, it is better to use command like cd \portables\Internet\Hist\, or maybe even cd %COMMANDER_DRIVE%\portables\Internet\Hist\, if this folder is on same drive with TC. You can add any number of such entries to directory hotlist and access them using mouse or keyboard.
If your portables folder is in drive's root, it is better to use command like cd \portables\Internet\Hist\, or maybe even cd %COMMANDER_DRIVE%\portables\Internet\Hist\, if this folder is on same drive with TC. You can add any number of such entries to directory hotlist and access them using mouse or keyboard.
OK, finally I found a first solution to this:
Creating a shortcut in "?:\Portables\System" with target:
"c:\Program Files\Totalcmd\TOTALCMD.exe" /O /S /L=%COMMANDER_DRIVE%\Portables\Internet\Hist
Cause this one doesn't work:
"c:\Program Files\Totalcmd\TOTALCMD.exe" /O /S /L=..\Internet\Hist
(and "START IN" blank)
Creating a shortcut in "?:\Portables\System" with target:
"c:\Program Files\Totalcmd\TOTALCMD.exe" /O /S /L=%COMMANDER_DRIVE%\Portables\Internet\Hist
Cause this one doesn't work:
"c:\Program Files\Totalcmd\TOTALCMD.exe" /O /S /L=..\Internet\Hist
(and "START IN" blank)
Sorry, that doesn't make any sense. Since you start Totalcmd.exe from C: the variable %COMMANDER_DRIVE% will always be C: or do you have two TC installations?liamZ wrote:"c:\Program Files\Totalcmd\TOTALCMD.exe" /O /S /L=%COMMANDER_DRIVE%\Portables\Internet\Hist
I'm still not sure what you're trying to accomplish. Do you start TC from a portable drive and you want to jump to folders on that drive?
You can use a variable in the link target:
%COMMANDER_DRIVE%\Portables\Internet\Hist
This works atleast with Win 8.1. From what I've read there was a problem that the variables get expanded right after you enter them but it works for me i.e. the variable stays a variable.
You can set a global variable with SetX. Create a cmd file on your portable drive with:
and run it as admin.
The variable %_portable_drive% will be available to all processes started after that. Make sure you clean up the variable when you're done via the GUI (see link).
Code: Select all
setx _portable_drive %~d0
The variable %_portable_drive% will be available to all processes started after that. Make sure you clean up the variable when you're done via the GUI (see link).