【发布时间】:2019-04-06 01:37:27
【问题描述】:
我的批处理文件非常简单。它启动一个程序,并将“我运行”回显到一个 .txt 文件中,以证明它是出于测试目的而运行的。我的任务计划程序任务的设置如下:
General:
- Run whether user is logged in or not.
- Run with highest privileges
- Configure for Windows 7, Windows Server 2008 R2
Trigger:
-At startup, 15 min delay
Action:
- Start a Program
- Program/Script: STARTRDM.BAT
- Add arguments (optional): blank
- Start in (optional): C:\Scripts\
Conditions: None
Settings:
- Allow task to be run on demand
- Stop the task if it runs longer than 1 hour
- If the running task does not end when requested, force it to stop
- If the task is already running, , do not start a new instance.
STARTRDM.BAT
>>log.txt echo I RAN
start C:\"Program Files (x86)"\Devolutions\"Remote Desktop Manager"\RemoteDesktopManager64.exe`
如果我双击批处理文件,它会按预期启动程序并写入 .txt 文件。如果我通过任务计划程序运行批处理文件,.txt 会按预期附加,但程序没有启动。这快把我逼疯了!
【问题讨论】:
-
不确定,如果它解决了你的问题,但你真的应该引用整个事情而不是仅仅引用它的一部分:
start "" "C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager64.exe"。""是因为start将第一个引用的参数作为窗口标题(给它任何值或""为“空”) -
为什么不让任务计划程序直接运行可执行文件?
-
Start以不寻常的方式启动程序。你为什么使用start?。见stackoverflow.com/questions/41030190/command-to-run-a-bat-file/… -
感谢 Stephan,但我已经尝试过这种特定的语法。
-
Run whether user is logged in or not在不访问桌面/屏幕/视频的情况下运行任务。我猜RemoteDesktopManager64是一个 GUI 程序?
标签: batch-file cmd task scheduler