我正在尝试从运行对话框运行 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'
但读取参数时失败。
Running .\script.ps1 -title 'Hello world' -msg 'This is a test message'
在 powershell 上工作正常。
Use -file
在脚本路径之前:
powershell.exe -noexit -file 'D:\Tasks Scripts\Powershell\script.ps1' etc...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)