Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用7zip.exe加速Powershell中的解压缩过程_Powershell_Powershell 5.0 - Fatal编程技术网

如何使用7zip.exe加速Powershell中的解压缩过程

如何使用7zip.exe加速Powershell中的解压缩过程,powershell,powershell-5.0,Powershell,Powershell 5.0,我正在使用7zip exe解压powershell脚本中的文件,这需要花费大量时间来完成简单的工作(32个文件的解压时间几乎为45分钟到1小时30分钟)。还有其他选择吗 代码如下: Set-Alias sz "C:\Program Files\7-Zip\7z.exe" sz x $zipfilename -o"$unzipfolder" -y LogWrite "$zipfilename unzipped to $unzipfolder successfully" 如果从批处理文件运行,操

我正在使用7zip exe解压powershell脚本中的文件,这需要花费大量时间来完成简单的工作(32个文件的解压时间几乎为45分钟到1小时30分钟)。还有其他选择吗

代码如下:

Set-Alias sz "C:\Program Files\7-Zip\7z.exe"

sz x $zipfilename -o"$unzipfolder" -y
LogWrite "$zipfilename unzipped to $unzipfolder successfully"

如果从批处理文件运行,操作是否会更快?我想不会。我在您的(不完整的)代码片段中没有看到任何会导致PowerShell减慢外部程序执行速度的内容。档案有多大,您要提取多少文件(大约)?文件的平均容量为500mb p/f…总共32个countWell,提取16 GB压缩数据需要一段时间。PowerShell对此无能为力。有很多工具可以提取zip存档(如WinZip或WinRar)。PowerShell v5或更高版本甚至为此提供了cmdlet()。然而,以我的经验来看,7-zip工作得非常好,所以我也不希望问题出现在这方面。也许是一些防病毒干扰?你可以从现在开始调查一些事情,但Powershell不是其中之一。解压时,我会按降序查看
taskmanager/processexplorer/resourcemonitor
,并验证您的CPU是否得到了使用(理想情况下为100%)。如果是,我的下一步将是使用
procmon
,并在堆栈窗口中查找任何异常。如果这没有暗示你什么,我会试试WPA。使用
WPA
可以为您找到问题提供很高的保证(如果有问题的话!),但它需要实践来分析它提供的丰富信息。