This project has moved and is read-only. For the latest updates, please go here.

Multiple Dos command through Task scheduler Action without using batch file.

Oct 19, 2014 at 8:08 PM

In task scheduler action(s) I would like to execute following DOS commands without using any batch file. Would it be possible? Please help.

/ Store current date and time in a variable /
set TIMESTAMP=%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%-%TIME:~0,2%.%TIME:~3,2%.%TIME:~6,2%

/ Create directory /

/ Pass above created directory to one of the program /
HTBase.exe /full /logfile=%LOGDIR%\HTBase.log /r /y %APPDIR% %FULLDIR%/"%TIMESTAMP%" >> %LOGDIR%\HTBaseFullBackup.log

Currently it is done through batch file but I would like to execute these command through Task scheduler action(s) without using any batch file.

Oct 20, 2014 at 2:42 PM
Under Vista and later, you can use multiple actions. Order them in the order you want the DOS commands run and then put each command in a separate action. You will use the ExecAction class.
Oct 24, 2014 at 6:01 AM
Hi Dahall,

Thank you for your response. I can have multiple actions. But thing is that The output of following first action would be the input to second and third action.

1st action
set TIMESTAMP=%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%-%TIME:~0,2%.%TIME:~3,2%.%TIME:~6,2%

2nd action
The above 'TIMESTAMP' would be input to following action.

How can I achieve this? Please revert.

Oct 24, 2014 at 3:21 PM
You would have to do something like persist information to a temp file in between messages if you wanted to use separate actions. You could also use a PowerShell script. Actions do not have a way to maintain state between executions.
Marked as answer by pabitrad on 10/28/2014 at 10:27 AM
Oct 28, 2014 at 6:08 PM
The task is achieved through adding a action with PowerShell script. Thank you.