1

我正在使用 PSDrive 进行压缩存档,但我遇到了这个错误:

Compress-Archive : The path 'Z:\' either does not exist or is not a valid file system path.
At C:\Users\user\somefolder\script.ps1:34 char:5
+     Compress-Archive -Path ($ZDrive + $fileName + $csvExt) -Destinati ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Z:\:String) [Compress-Archive], InvalidOperationException
    + FullyQualifiedErrorId : ArchiveCmdletPathNotFound,Compress-Archive

PSDrive 代码和第 33 行和第 34 行的代码如下:

New-PSDrive -Name "Z" -Root $OutputDirectoryPath -PSProvider FileSystem;
$ZDrive = "Z:\";
query($CustomQuery) | Export-Csv -Path ($ZDrive + $fileName + $csvExt) -NoTypeInformation;
Compress-Archive -Path ($ZDrive + $fileName + $csvExt) -DestinationPath ($ZDrive + $fileName + $zipExt) -Force;
4

0 回答 0