批处理文件在执行下一条命令之前,要等待 powershell 行解压?

问题描述 投票:0回答:1

基本上,我有一个Batch文件,使用一行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...]
powershell batch-file cmd
1个回答
1
投票

就不要用 "start "了。 直接运行powershell就可以了。 在你的批处理文件中,也有几处需要修正。 把第二行改成这个命令。

powershell -executionpolicy unrestricted -command "Expand-Archive update.zip -DestinationPath $env:APPDATA\ModManager\ | out-null"
© www.soinside.com 2019 - 2024. All rights reserved.