【问题标题】:executing a batch file into a new command window using windows task schedular使用 Windows 任务调度程序将批处理文件执行到新的命令窗口
【发布时间】:2023-03-14 23:21:02
【问题描述】:

我有 test_run.bat 文件被安排在指定的时间和日期运行。我已使用以下命令将其添加到任务调度程序中:

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

我打算在这里运行“test_run.bat”,并以“release”作为参数。当此任务启动时,它会在后台运行。我希望它打开一个新的命令窗口(从该批处理文件所在的文件夹开始)并运行该批处理文件。

我怎样才能做到这一点?上面提到的两行是否正确(考虑释放作为参数)?

使用开始:

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%

我说的对吗?

【问题讨论】:

    标签: windows scheduled-tasks batch-file


    【解决方案1】:

    start 命令创建一个新的命令窗口。

    最简单的命令

    start test.bat
    

    将创建一个新的命令窗口并在其中运行批处理文件。

    【讨论】:

    • 如果我将“start /c”添加到“testfile”变量中是否正确?
    猜你喜欢
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    • 2013-12-13
    • 2013-09-24
    • 1970-01-01
    • 2014-02-23
    • 1970-01-01
    相关资源
    最近更新 更多