【发布时间】:2017-05-28 20:31:50
【问题描述】:
我正在使用 PowerShell 从电子邮件中下载数据。
我想通过 PowerShell 运行这个进程。当我像这样运行脚本时:
D:\script.ps1
在powershell.exe 中它工作正常。
当我在任务计划程序中安排它时,没有任何反应。
我尝试将其设置为程序/脚本:
powershell
Powershell.exe
powershell.exe
添加参数:
-executionpolicy bypass -file D:\script.ps1
-file D:\script.ps1
-file "D:\script.ps1"
没有任何效果。我使用的是 Windows 2008 R2。
【问题讨论】:
-
powershell 会启动吗?我猜它要么是路径错误,要么是执行策略,但现在很难从你的问题中分辨出来。尝试(1)添加标志
-noexit应该可以帮助您查看错误消息(如果有)和(2)指定powershell的完整路径,例如C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
标签: windows powershell windows-server-2008-r2 taskscheduler