我有以下 PS 脚本:
function Install-BizTalkApplication
{
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage="Msi file should be existing")]
[ValidateScript({Test-Path $_})]
[Alias("msi")]
[string]$MsiFile,
[Parameter(Position=1,HelpMessage="Path wherein the resource file will be installed")]
[Alias("path")]
[string]$ApplicationInstallPath,
[Parameter(Position=2,Mandatory=$true,HelpMessage="Only valid parameters are Local,Dev,Test and Prod")]
[Alias("env")]
[ValidateSet("Local","Dev","Prod","Test")]
[string]$Environment,
[bool]$BTDeployMgmtDB=$true,
[bool]$SkipUndeploy=$true
)
使用 Powershell ISE 我尝试运行脚本,传递 3 个参数,如下所示:
BTDF\Sources\Deployment\BuildAndDeploy.ps1 -msi "C:\Builds\1\CIDemo2\CIDemo2 BTDF\Sources\Deployment\bin\Debug\CIDemo-1.0.0.msi" -ApplicationInstallPath "c:\program files (x86)\CIDemo" -Environment "Dev"
但我收到以下错误:
The string starting:
At line:1 char:1
+ <<<< 'C:\Builds\1\CIDemo2\CIDemo2 BTDF\Sources\Deployment\BuildAndDeploy.ps1 -msi "C:\Builds\1\CIDemo2\CIDemo2 BTDF\Sources\Deployment\bin\Debug\CIDemo-1.0.0.msi" -ApplicationInstallPath "c:\program files
(x86)\CIDemo" -Environment "Dev"
is missing the terminator: '.
At line:1 char:233
谁能解释一下我应该如何传递包含空格的参数。我尝试过使用单引号,但没有任何乐趣。