问题描述
我有一个 PowerShell 脚本,它通过要求用户输入然后保存在两个必需参数中的信息来基本上启动工作流程。
我遇到的问题是,当我在 Powershell ISE 中调用脚本中的函数并以以下格式传递参数值时,它工作正常。
WithParam -Name Test -IPAddress 10.10.0.1
但是,从 Windows PowerShell(点源)运行脚本不断提示我再次输入值,然后执行工作流程
.\WithParam.ps1 -Name Test -IPAddress 10.10.0.1
我收到的消息是Supply values for the following parameters
param(
[Parameter(Mandatory=$true)]
[Alias('host')]
Name,[Parameter(Mandatory=$true)]
[Alias('location')]
IPAddress
)
有什么我遗漏的吗?
编辑
function Testm {
[CmdletBinding()]
param(
[Parameter(Mandatory = $True)]
$Name
)
Write-Host " The server name is $Name"
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)