【发布时间】:2015-12-30 11:25:03
【问题描述】:
我正在尝试从 AppVeyor 中的 choco install 命令中删除一些冗长的内容。这是我一直在尝试的(建议here):
if (Test-Path "C:/ProgramData/chocolatey/bin/swig.exe") {
echo "using swig from cache"
} else {
choco install swig > NUL
}
但是它失败了:
Redirection to 'NUL' failed: FileStream will not open Win32 devices such as
disk partitions and tape drives. Avoid use of "\\.\" in the path.
At line:4 char:5
+ choco install swig > NUL
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : RedirectionFailed
Command executed with exception: Redirection to 'NUL' failed: FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in the path.
所以我的问题是有没有办法在 AppVeyor 上的 PowerShell 中抑制 choco install 命令的冗长?
【问题讨论】:
-
choco install swig > $null -
抛出这个 - 你应该将
-y添加到参数中,因为它可能无法完成安装,具体取决于 choco 的版本。
标签: powershell chocolatey appveyor