首页 > 解决方案 > 批处理文件在执行下一个命令之前等待powershell行解压缩?

问题描述

基本上我有一个批处理文件,它使用单行 powershell 命令解压缩文件,但它不会等待该 powershell 命令完成执行。Call不工作,start /w不工作,start powershell [cmd] -Wait不工作 我该怎么办?

cd..
start powershell Expand-Archive update.zip -DestinationPath %appdata%\ModManager\ > nul
cd %appdata%\ModManager\
[other code...]

标签: powershellbatch-filecmd

解决方案


只是不要使用“开始”。直接运行powershell。您还需要在批处理文件中修复一些问题。用这个命令代替第二行:

powershell -executionpolicy unrestricted -command "Expand-Archive update.zip -DestinationPath $env:APPDATA\ModManager\ | out-null"

推荐阅读