我正在尝试创建一个Windows批处理脚本,允许我为Windows 7 64位部署准备更新,但脚本无法正常启动。我有相同文件夹内的所有文件,我试图提取文件然后通过dism安装它们当我正常启动它时文件解压缩但dism无法正确启动,当我以管理员身份运行时文件将无法提取和dism退出代码2.我做错了什么?
expand -F:* .\Windows6.1-KB3135445-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3135445-x64.cab
expand -F:* .\Windows6.1-KB3050265-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3050265-x64.cab
expand -F:* .\Windows6.1-KB3065987-v2-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3065987-v2-x64.cab
expand -F:* .\Windows6.1-KB3102810-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3102810-x64.cab
expand -F:* .\Windows6.1-KB3138612-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3138612-x64.cab
expand -F:* .\Windows6.1-KB3161608-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3161608-x64.cab
expand -F:* .\Windows6.1-KB3161664-x64.msu .\
timeout 2
DISM.exe /online /Add-Package /PackagePath:.\Windows6.1-KB3161664-x64.cab
pause
答案 0 :(得分:0)
'以管理员身份运行更改当前目录!添加这些行以证明自己。下面的第二行将为您恢复它。稍后删除ECHO语句。
echo %cd%
pushd %~dp0
echo %cd%
同时在结尾添加此行:
popd