Does TC have Date Parameter
Moderators: Hacker, petermad, Stefan2, white
Does TC have Date Parameter
hi
i would like to launch a program and send it current date in YYYY-MM-DD format does TC have parameters to get current and format date.
just like %P %N %T..
is there %YYYY-%MM-%DD
any help appreicated?
thanks
ehab
i would like to launch a program and send it current date in YYYY-MM-DD format does TC have parameters to get current and format date.
just like %P %N %T..
is there %YYYY-%MM-%DD
any help appreicated?
thanks
ehab
Last edited by ehab on 2007-11-13, 18:36 UTC, edited 1 time in total.
I miss this feature too. Additionally to the above it could be used
to create new directories containing the actual date, e.g. through a user defined command
(em_MkDirDate, type "NewDir" in the dialog and get "20071113_NewDir" created).
This would be a great enhancement, IMO - Support+.
to create new directories containing the actual date, e.g. through a user defined command
(em_MkDirDate, type "NewDir" in the dialog and get "20071113_NewDir" created).
This would be a great enhancement, IMO - Support+.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
Found some solutions (thanks for the idea, Sir SiLvA)...
All depend on the regional date format settings, I assume %date% to be something like "Tue 13.11.2007" like it is here.
You can find out yours by typing "echo %date%" on the command line.
I hope I have included all possible separator characters (delims=),
maybe the order of %g%f%e has to be adjusted to your local needs, e.g. %e-%f-%g.
Note: The "Command: " for TC below is always a single line - if there is a line break while displaying in your browser, the second line has to be appended to the first, separated by a space.
The simple one, if only the date has to be passed or spaces between the date and possible additional parameters are OK, then TC is enough:
e.g. in the starter menu:Parameter field can be left empty, if only the date has to be submitted.
The more complete one, if you'd like to achieve something like "20071113_new dir name" this can be done with an external batch.
E.g. in the starter menu:
...with mdconcat.cmd containing the following (substitue "md" with the program name you like):
All depend on the regional date format settings, I assume %date% to be something like "Tue 13.11.2007" like it is here.
You can find out yours by typing "echo %date%" on the command line.
I hope I have included all possible separator characters (delims=),
maybe the order of %g%f%e has to be adjusted to your local needs, e.g. %e-%f-%g.
Note: The "Command: " for TC below is always a single line - if there is a line break while displaying in your browser, the second line has to be appended to the first, separated by a space.
The simple one, if only the date has to be passed or spaces between the date and possible additional parameters are OK, then TC is enough:
e.g. in the starter menu:
Code: Select all
Command: %comspec% /c for /F "usebackq tokens=2,3,4 delims=.,;:-/\ " %e in (`echo %date%`) do YourCommandHere.exe %g%f%e
Parameters: ?
The more complete one, if you'd like to achieve something like "20071113_new dir name" this can be done with an external batch.
E.g. in the starter menu:
Code: Select all
Command: %comspec% /c for /F "usebackq tokens=2,3,4 delims=.,;:-/\ " %e in (`echo %date%`) do mdconcat.cmd %g%f%e_
Parameters: ?
Code: Select all
: rem MdConcat.cmd (W) StatusQuo 2007
: rem concat given parameters (maybe each in quotes)
: rem to a string; no space between 1st + 2nd parameter
: rem
: rem Example:
: rem MdConcat "20071113_" NewDir 01
: rem will make a dir "20071113_NewDir 01"
@echo off %debug% >nul
if "%~1"=="" goto ex
setlocal
set mdtmp=%~1%~2
:Loop
if "%~3"=="" goto EndLoop
set mdtmp=%mdtmp% %~3
shift
goto Loop
:EndLoop
md "%mdtmp%"
:ce
:ex
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
http://www.ghisler.ch/wiki/index.php/AutoHotkeyi would like to launch a program and send it current date in YYYY-MM-DD format
LaunchAndSendDateAsParameter.ahk:
Run, X:\path\to\blabla.exe %A_YYYY%-%A_MM%-%A_DD%
Icfu
This account is for sale
Thanks to all
and specially StatusQuo , i have different short date format so i had to change tokens=2,3,4 a bit but all is well.
is it too much to ask if you can explain or provide some links about " The simple one " , for example HOw does the %g%f%e work and what are they for.
Thanks again. appreciated : )
and specially StatusQuo , i have different short date format so i had to change tokens=2,3,4 a bit but all is well.
is it too much to ask if you can explain or provide some links about " The simple one " , for example HOw does the %g%f%e work and what are they for.
Thanks again. appreciated : )
#181344 Personal licence
For NT systems:
C:\> copy nul %Date:~-4,4%-%Date:~-7,2%-%Date:~-10,2%.txt
gives "2007-11-13.txt"
C:\>md nul Download_%Date:~-2,2%%Date:~-7,2%
gives new folder "Download_0711"
You can execute this user commands with command line alias too:
C:\> copy nul %Date:~-4,4%-%Date:~-7,2%-%Date:~-10,2%.txt
gives "2007-11-13.txt"
Code: Select all
[em_CreateNewFile]
cmd=%comspec% /c copy nul
Param=?_%%Date:~-4,4%%-%%Date:~-7,2%%-%%Date:~-10,2%%.txt
C:\>md nul Download_%Date:~-2,2%%Date:~-7,2%
gives new folder "Download_0711"
Code: Select all
[em_MD_Download0711]
cmd=%comspec% /c md nul
Param=Download_%%Date:~-2,2%%%%Date:~-7,2%%
icfu wrote: Aliases are meant to be typed(!) in command line, as an alternative to a
button, a shortcut, a starter or menu entry. So, if you want to create a
directory NewDir, just type "mdd NewDir" in command line and it will work.Put an alias placeholder where you want to haveCode: Select all
[Alias] mdd=em_MkDirDate [em_MkDirDate] cmd=%comspec% /c param=md "%%date:~-4,4%%%%date:~-7,2%%%%date:~-10,2%%_%A"
an alternative text every time. See the %A in the code above.
Then you can use:
=> mdd NewDir
to get an new dir with current date and an flexible part at place of the %A
If you need a shortcut: Assign Ctrl+Shift+F7 to em_MkDirDate in Configuration -> Misc, or edit INI:
Edit the user-defined command andCode: Select all
[Shortcuts] CS+F7=em_MkDirDate
prepend a question mark in parameters field
to have a dialog box open whenever you press the shortcut:Code: Select all
param=?md "%%date:~-4,4%%%%date:~-7,2%%%%date:~-10,2%%_%A"
http://www.ghisler.ch/board/viewtopic.php?t=16094
Posted: Wed Jun 27, 2007 05:22 Post subject: Reply with quote
2KucingLapar
Try to use one of these tools:
http://en.totalcmd.pl/download/add/add/Newfile (Big Dialog and Templates)
http://en.totalcmd.pl/download/add/Add/New_File (Small Editbox, Folder or File)
http://en.totalcmd.pl/download/add/add/1_Click_New_File
_________________
DJK
Totally addicted to Total Commander
http://en.totalcmd.pl/download/add/Add/New_File
Run NewFile.exe and write file folder name in dialog box.
If you confirm with Return key - You will have a directory.
With Ctrl+Return - an empty file.To cancel - press Esc
Default name is current date, but you can change it.
Simply run NewFile.exe with new format string as a parameter
%Commander_Path%\Plugins\NewFiles101\NewFile.exe New_%Y-%m-%d.txt
%Commander_Path%\Plugins\NewFiles101\NewFile.exe NewDir_%Y-%m-%d-%H%M%S
Last edited by Stefan2 on 2007-11-14, 07:15 UTC, edited 2 times in total.
2ehab
on the command line.
How my "simple" version works:
usebackq: prevent confusion if double quotes appear in the line
tokens=2,3,4: what parts of the line are used (# 2, 3, 4 here)
delims=.,;:-/\ : which characters in the line separate the parts from each other
in (`echo %date%`): use the output of the echo command
%g%f%e: %e is used as the variable for the first used part/token (which is #2 as specified before: tokens=2,3,4); %f is token 3, %g is token 4.
You can get a complete syntax description withfor example HOw does the %g%f%e work and what are they for.
Code: Select all
FOR /?
How my "simple" version works:
%comspec% /c for: start command line, execute FOR command, then exit command line.%comspec% /c for /F "usebackq tokens=2,3,4 delims=.,;:-/\ " %e in (`echo %date%`) do YourCommandHere.exe %g%f%e
usebackq: prevent confusion if double quotes appear in the line
tokens=2,3,4: what parts of the line are used (# 2, 3, 4 here)
delims=.,;:-/\ : which characters in the line separate the parts from each other
in (`echo %date%`): use the output of the echo command
%g%f%e: %e is used as the variable for the first used part/token (which is #2 as specified before: tokens=2,3,4); %f is token 3, %g is token 4.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
2Stefan2
I assume the "nul" above is a copy&paste error, but apart from that this works well, too.
Thanks a lot!
Wow, great - this is even simpler.C:\>md nul Download_%Date:~-2,2%%Date:~-7,2%
I assume the "nul" above is a copy&paste error, but apart from that this works well, too.
Thanks a lot!
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
FYI: Syntax is explained here:
=> set /?
=> mdd NewDir
Icfu
=> set /?
Can be done like that (Stefan2 has forgotten %A above...):e.g. through a user defined command
(em_MkDirDate, type "NewDir" in the dialog and get "20071113_NewDir" created
Code: Select all
[Alias]
mdd=em_MkDirDate
[em_MkDirDate]
cmd=%comspec% /c
param=md "%%date:~-4,4%%%%date:~-7,2%%%%date:~-10,2%%_%A"
Icfu
This account is for sale
2icfu
Thanks for the additional info, now it's working as alias, too.
The drawback of user-defined commands seems to be,
that I can't manage to assign a keyboard shortcut to this (having a dialog box for parameters).
(Ctrl-Shift-F7 would be nice, with Ctrl-Alt-F7 I could live, too - the way I use the batch solution now.)
What I tried:
The starter menu does not allow the alias (mdd not found),
nor the user-defined command (em_MkDirDate: no parameter input possible).
Neither does Configuration->Misc.,
the same on the button bar (additionally no shortcuts can be defined here).![Confused :?](./images/smilies/icon_confused.gif)
Does it really need AHK to get a keyboard shortcut for a user-defined command, or have I just overlooked this option??
Thanks for the additional info, now it's working as alias, too.
The drawback of user-defined commands seems to be,
that I can't manage to assign a keyboard shortcut to this (having a dialog box for parameters).
(Ctrl-Shift-F7 would be nice, with Ctrl-Alt-F7 I could live, too - the way I use the batch solution now.)
What I tried:
The starter menu does not allow the alias (mdd not found),
nor the user-defined command (em_MkDirDate: no parameter input possible).
Neither does Configuration->Misc.,
the same on the button bar (additionally no shortcuts can be defined here).
![Confused :?](./images/smilies/icon_confused.gif)
Does it really need AHK to get a keyboard shortcut for a user-defined command, or have I just overlooked this option??
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
Aliases are meant to be typed(!) in command line, as an alternative to a button, a shortcut, a starter or menu entry. So, if you want to create a directory NewDir, just type "mdd NewDir" in command line and it will work.
If you need a shortcut: Assign Ctrl+Shift+F7 to em_MkDirDate in Configuration -> Misc, or edit INI:
Edit the user-defined command and prepend a question mark in parameters field to have a dialog box open whenever you press the shortcut:
param=?md "%%date:~-4,4%%%%date:~-7,2%%%%date:~-10,2%%_%A"
It would be much better if TC would only request the relevant parameter %A in this case of course but until now %A only has an effect in command line. Should be requested...
Icfu
If you need a shortcut: Assign Ctrl+Shift+F7 to em_MkDirDate in Configuration -> Misc, or edit INI:
Code: Select all
[Shortcuts]
CS+F7=em_MkDirDate
param=?md "%%date:~-4,4%%%%date:~-7,2%%%%date:~-10,2%%_%A"
It would be much better if TC would only request the relevant parameter %A in this case of course but until now %A only has an effect in command line. Should be requested...
Icfu
This account is for sale
2icfu
Now I have 4 different ways of creating 20071113_NewDir without typing the date to choose from -
two with batch (only showing the "NewDir" part in the dialog) and two without external files.
Time will show which one will survive the longest.![Smile :)](./images/smilies/icon_smile.gif)
Yes, it does.type "mdd NewDir" in command line and it will work.
Aah, right, the question mark. This was the overlooked part, thanks again.Edit the user-defined command and prepend a question mark in parameters field
Now I have 4 different ways of creating 20071113_NewDir without typing the date to choose from -
two with batch (only showing the "NewDir" part in the dialog) and two without external files.
Time will show which one will survive the longest.
![Smile :)](./images/smilies/icon_smile.gif)
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
what if I want to use this with cd commandicfu wrote:FYI: Syntax is explained here:
=> set /?
Can be done like that (Stefan2 has forgotten %A above...):e.g. through a user defined command
(em_MkDirDate, type "NewDir" in the dialog and get "20071113_NewDir" created=> mdd NewDirCode: Select all
[Alias] mdd=em_MkDirDate [em_MkDirDate] cmd=%comspec% /c param=md "%%date:~-4,4%%%%date:~-7,2%%%%date:~-10,2%%_%A"
Icfu
cd d:\downloads\%Date:~-7,2%\%Date:~-10,2%
i tried this but it did not worked.