运行MSU不工作

时间:2016-09-15 16:59:57

标签: batch-file

@echo off
Set "InputFile=%~dp0InputFile.txt"
Set "OutputFile=%~dp0OutputFile.txt"
set "String1=$cc = 3333"
set "String2=cc = 4444" 
if exist "%OutputFile%" Del "%OutputFile%"
Setlocal EnableDelayedExpansion
for /f "delims=" %%i in ('Type "%InputFile%"') do (
    If /I "%%i" == "%String1%" (
        Call :ReplaceString "%%i" "%String1%" "%String2%"
        echo !Data!
        ) else (
        echo %%i
    )
)>> "%OutputFile%"
start "" "%OutputFile%" & exit
::*************************************************************************************
:ReplaceString <Data> <String1> <String2>
(
    echo Wscript.echo Replace("%~1","%~2","%~3"^)
)>"%tmp%\%~n0.vbs"
for /f "delims=" %%a in ('Cscript /nologo "%tmp%\%~n0.vbs"') do ( set "Data=%%a" )
If Exist "%tmp%\%~n0.vbs" Del "%tmp%\%~n0.vbs"
exit /b
::*************************************************************************************

我有一个包含上述代码的.bat文件。该文件位于\ wds \ e $ \ Shared \ DeploymentBuild \ Applications \ Microsoft WMF 5.0。

问题是,当我运行它时,它会启动&#34; Windows Update独立安装程序&#34;窗口,它不会进行静默安装。

我在本地计算机上有相同的.bat文件的副本,并且它没有任何问题。请帮我解决这个问题。

谢谢,

1 个答案:

答案 0 :(得分:0)

首先相应地更改批处理文件:

@echo off
if not exist "%~dp0Win7AndW2K8R2-KB3134760-x64.msu" (
    Echo= The MSU file isn't here!
    Timeout -1 >Nul
    Exit/B)
wusa.exe "%~dp0Win7AndW2K8R2-KB3134760-x64.msu" /quiet /norestart