[英]Using Task Scheduler to run a batch file that contains the start /w command
I have a Windows XP virtual machine that I am using to run a legacy app. 我有一个用于运行旧版应用程序的Windows XP虚拟机。 I am using a limited user account.
我使用的是受限用户帐户。
I have created a batch file that I'd like to: 我创建了一个我想要的批处理文件:
So this is the code I am using (in this example, I am attempting to open notepad): 这是我正在使用的代码(在此示例中,我尝试打开记事本):
@ECHO OFF
start /w notepad
%windir%\system32\shutdown.exe -f -s -t 1
Because the legacy app needs to be run under an account with administrator privileges, I then manually created a scheduled task in Task Scheduler to run the batch file. 由于旧版应用程序需要在具有管理员特权的帐户下运行,因此我在Task Scheduler中手动创建了计划任务以运行批处理文件。 The scheduled task is set to run using an account named Admin that has administrator privileges.
计划的任务设置为使用名为Admin的帐户运行,该帐户具有管理员权限。
I am having a bit of an issue. 我有一个问题。 When the scheduled task runs, nothing appears on the screen.
当计划的任务运行时,屏幕上不显示任何内容。 However, I did notice that both cmd.exe and notepad.exe appear in Task Manager as processes running as the user Admin.
但是,我确实注意到cmd.exe和notepad.exe都以“管理员”用户身份运行在任务管理器中。
What am I doing wrong? 我究竟做错了什么? How can I accomplish what I'd like to do?
我该如何完成自己想做的事情? Thanks!
谢谢!
Sorry all, it was an issue with me not having Task Scheduler set up properly. 对不起,这是我没有正确设置Task Scheduler的问题。 I found this post which suggests to use the AT command to run the task interactively.
我发现这篇文章建议使用AT命令以交互方式运行任务。 This allows the Cmd window to be displayed when a batch file is run as a Scheduled Task.
当批处理文件作为计划任务运行时,这允许显示Cmd窗口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.