我有一个试图通过 teamcity 运行的 powershell 脚本。该脚本存储在构建代码的 git 存储库中。我已将 teamcity 设置为将脚本作为脚本文件运行
如果我从构建服务器上的 powershell 命令行运行脚本,它会按预期运行,如果我从 teamcity 运行相同的脚本,我会收到类似的错误
[16:04:25][Step 3/3] Get-Date : Cannot bind parameter 'Date'. Cannot convert value "–f" to type
[16:04:25][Step 3/3] "System.DateTime". Error: "The string was not recognized as a valid DateTime.
[16:04:25][Step 3/3] There is an unknown word starting at index 0."
[16:04:25][Step 3/3] At line:1 char:26
[16:04:25][Step 3/3] + Write-Output "$(Get-Date –f $timeStampFormat) - Upgrading Deployment: In
[16:04:25][Step 3/3] progr ...
[16:04:25][Step 3/3] + ~~~~
[16:04:25][Step 3/3] + CategoryInfo : InvalidArgument: (:) [Get-Date], ParameterBindin
[16:04:25][Step 3/3] gException
[16:04:25][Step 3/3] + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerSh
[16:04:25][Step 3/3] ell.Commands.GetDateCommand
[16:04:25][Step 3/3]
为什么会发生这种情况?