我正在尝试从运行对话框运行Powershell脚本(将用作计划任务),并且在传递参数方面遇到麻烦。
该脚本将接受两个参数,名为title和msg。该脚本位于:D:\Tasks Scripts\Powershell\script.ps1
这就是我想要做的:
powershell.exe -noexit 'D:\Tasks Scripts\Powershell\script.ps1' -title 'Hello world' -msg 'This is a test message'
但是在读取参数时失败。
运行.\script.ps1 -title 'Hello world' -msg 'This is a test message'
在PowerShell的正常工作。
-file
在脚本路径之前使用:
powershell.exe -noexit -file 'D:\Tasks Scripts\Powershell\script.ps1' etc...
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句