简体   繁体   English

显示Powershell计划任务的CMD窗口

[英]Show CMD window for Powershell Scheduled Task

I have a power shell script that runs 3 batch files. 我有一个运行3个批处理文件的Power Shell脚本。 When running this with task scheduler, I want to be able to see the cmd windows with the batch files running. 使用任务计划程序运行此程序时,我希望能够看到运行批处理文件的cmd窗口。 Is this possible. 这可能吗。

I'll summarize the answer from the post Windows 7 Task Scheduler to start application in user session . 我将总结Windows 7 Task Scheduler中的答案, 以在用户会话中启动应用程序

When a scheduled task is executed, it is run in session 0, which means that the windows won't display. 执行计划任务时,它将在会话0中运行,这意味着将不会显示窗口。 To have Task Scheduler show when a task is running, run it in interactive mode. 若要使Task Scheduler在任务运行时显示,请以交互方式运行它。 It appears this option can only be set from the schtasks utility and not from the task scheduler. 看来只能从schtasks实用程序设置此选项,而不能从任务计划程序设置。

/IT: A value that enables the task to run interactively only if the /RU user is currently logged on at the time the task runs. / IT:仅当/ RU用户当前在任务运行时已登录时,该值才能使任务交互式运行。 The task runs only if the user is logged on. 仅当用户登录时,任务才会运行。

schtasks /Create /IT ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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