【问题标题】:Task Scheduler Runs Batch File - Batch File Only Works Partially?任务计划程序运行批处理文件 - 批处理文件仅部分工作?
【发布时间】: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


【解决方案1】:

好吧,我想通了,所以我想我会发布解决方案。

我正在处理的站点设置为信息亭。 Kiosk 帐户通常是在此系统上登录的帐户。我使用单独的管理员帐户在任务计划程序中编写任务,因为 Kiosk 没有必要的权限。默认情况下,“运行此任务时,请使用以下用户帐户:”字段设置为您运行任务计划程序的任何帐户。当我将此字段切换到 Kiosk 用户时,它解决了我的问题。

【讨论】:

    猜你喜欢
    • 2013-03-01
    • 2014-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-14
    • 1970-01-01
    • 1970-01-01
    • 2013-10-19
    相关资源
    最近更新 更多