N D Thokare
N D Thokare

Reputation: 1743

executing a batch file into a new command window using windows task schedular

I have test_run.bat file to be scheduled to run at specified time and date. I have added this into a task scheduler using following comand:

set testfile=%%~dp0%test_run.bat release
schtasks /create /tn "test_run" /tr "%testfile%" /sc weekly /d * /mo 1 /st %tt% /sd %dd%

here I'm planning to run "test_run.bat" with "release" as an argument to it. When this task starts, it runs in the background. I want this to open a new command window (starting into a folder where this batch file exists) and run this batch file.

How can I achieve this? Are above mentioned two lines correct(considering release as an argument)?

Using start:

set testfile=start /c %%~dp0%test_run.bat release
schtasks /create /tn "test_run" /tr "%testfile%" /sc weekly /d * /mo 1 /st %tt% /sd %dd%

I this correct?

Upvotes: 0

Views: 2199

Answers (1)

Ian Goldby
Ian Goldby

Reputation: 6174

The start command creates a new command window.

At its very simplest, the command

start test.bat

will create a new command window and run the batch file in it.

Upvotes: 3

Related Questions