无论用户是否已在PowerShell中登录,如何安排任务? [英] How to schedule a task wether the user is logged on or not in PowerShell?

查看:141
本文介绍了无论用户是否已在PowerShell中登录,如何安排任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,无论用户是否登录,如何使计划任务运行.它必须在powershell中完成.我所做的是:

I have a problem regarding how to make a scheduled task to run whether the user is logged on or not. It must be done in powershell. What i have done is:

$WINDIR/system32/schtasks.exe /create /tn TaskName /sc daily /st 15:05:00 /tr "C:\cygwin\opt\IBM\tpchc\bin\tools\TheFileToRun.bat"

但是无论用户是登录还是注销,我能否提供一个额外的参数来使此任务运行?

But can i provide an extra argument making this task run no matter if the user is logged on or off?

如果无法在Powershell中完成此操作,那么是否可以使用另一种脚本语言来完成?

If it cant be done in Powershell is it then possible to do it in another script language?

thx:)

推荐答案

您需要指定一个用户(例如/RU system),但是无论是否登录,它都应该是默认值.您可以查看此链接列出所有schtasks.exe参数.

You'll need to specify a user (like /RU system), but it should be the default whether to run logged in or not. You can look at this link for a list of all schtasks.exe parameters.

这篇关于无论用户是否已在PowerShell中登录,如何安排任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆