找不到接受参数'Files'的位置参数



如果我将目标路径传递为 C:\Program Files\,我正在尝试在 powershell 中使用扩展存档解压缩文件,我收到以下错误。 但是,如果我指定 C:\用户\测试\下载,它可以工作。

PS C:UserstestDownloads> Expand-Archive -Path C:WindowsTempnginx-1.16.1.zip -DestinationPath  C:Program Files
Error:
Expand-Archive : A positional parameter cannot be found that accepts argument 'Files'.
At line:1 char:1
+ Expand-Archive -Path C:WindowsTempnginx-1.16.1.zip -DestinationPat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Expand-Archive], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Expand-Archive

我尝试传递"$env:PROGRAMFILES"并得到同样的错误。

Expand-Archive -Path C:WindowsTempnginx-1.16.1.zip -DestinationPath '$env:PROGRAMFILES' 

如何将参数 C:\Program Files\ 作为目标路径传递给 PowerShell。

您遇到的问题是您正在使用包含空格的C:Program Files,因此您需要包装与PowerShell完成"C:Program Files"一样。

最新更新