简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM