各位晚上好,
我使用的命令行在以下脚本中将参数作为变量传递给变量,以便在我从此脚本中调用的另一个ps1中运行。每当我尝试从命令行传递参数时,我都会收到以下错误消息
Start-Process:找不到接受参数的位置参数
有人可以协助吗?
感谢您的宝贵时间,非常感谢您的帮助。
param
(
[string]$targetserver = $args[0], #target server
[string]$module = $args[1], #module name
)
function Get-Script-Directory
{
return Split-Path $script:MyInvocation.MyCommand.Path
}
Start-Process powershell.exe (Join-Path (Get-Script-Directory) "...\StopServices.ps1") -ArgumentList $targetserver $module
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句