如何安排此.ps1文件每天运行?

时间:2019-02-01 16:31:02

标签: powershell scheduled-tasks filesystemwatcher taskscheduler ps1

我有一个.ps1文件,当我在PowerShell中运行它时可以工作(它注册了一个filesystemwatcher来监视excel文件中的更改),但是当我在任务计划程序中计划它时,它无法工作。

这是因为我的输入已关闭,还是需要将此.ps1导出到其他内容中?

我的输入-

程序= PowerShell.exe

添加参数= -ExecutionPolicy绕过\ blah blah \ testing file.ps1

开始为空

1 个答案:

答案 0 :(得分:0)

尝试一下:

操作:启动程序

程序:C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe

参数:-ExecutionPolicy绕过-file“ \ blah blah blah \ testing file.ps1”