Change Directory Menu: Need Help with Parameters: "cd c:\%Date:~-4,4%"

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Faraday
Junior Member
Junior Member
Posts: 2
Joined: 2021-02-16, 14:39 UTC

Change Directory Menu: Need Help with Parameters: "cd c:\%Date:~-4,4%"

Post by *Faraday »

Hello,
I need a little help - maybe someone knows the solution.
When in "change directory menu" (ctr-D -> configure) I put comand like this: cd c:\%Date:~-4,4%\ (which now coresponds to c:\2021\) it doesn't works.
But it works at Windows command line window.

Is there alternate function to made dynamic directory menu such as: c:\<current year>\?

Best Regards.
User avatar
nsp
Power Member
Power Member
Posts: 1924
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Change Directory Menu: Need Help with Parameters: "cd c:\%Date:~-4,4%"

Post by *nsp »

Variable substitution is done in command line interpreter CMD.exe.
iF you want to do so you have to create a small batch that call TC like

Code: Select all

@"%commander_exe%" /S c:\%Date:~-4,4%\ 
and then call this batch...

// to create folder you can use <[Y] but this syntax is not valid with CD
User avatar
petermad
Power Member
Power Member
Posts: 16034
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Change Directory Menu: Need Help with Parameters: "cd c:\%Date:~-4,4%"

Post by *petermad »

2Faraday

You can put this command in your usercmd.ini file:

Code: Select all

[em_goto_datedir]
cmd=%COMSPEC% /C
param="%%COMMANDER_EXE%%" /O /S c:\%%Date:~-4,4%%\
iconic=1
and then use this in the Command field of the "Change directory menu" item:

Code: Select all

em_goto_datedir

The usercmd.ini is in the same folder as your wincmd.ini file. If it is not there - then make it (it is a simple ANSI text file)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Faraday
Junior Member
Junior Member
Posts: 2
Joined: 2021-02-16, 14:39 UTC

Re: Change Directory Menu: Need Help with Parameters: "cd c:\%Date:~-4,4%"

Post by *Faraday »

Thank all of You very much all.
Post Reply