Jump to content

Windows Update installation by commandline


hp owner

Recommended Posts

I have downloaded all the Windows 7 Updates into the "%USERPROFILE%\Desktop\Windows Updates\". Al the files are saved as "001. X64.msu", "001. X86.msu", "002. X64.msu", "002. X86.msu" ............................"XXX. X64.msu", "XXX. X86.msu". My Windows 7 is 64 Bit. My requirement is to run all the updates sequentially one by one.

Then have created "wusa.bat" with the following codes:

@echo off
cls

if %PROCESSOR_ARCHITECTURE%==x86 set arch=x86
if %PROCESSOR_ARCHITECTURE%==AMD64 set arch=x64
for /F "tokens=4-5 delims=[.] " %%A in ('ver') do set ver=%%A.%%B
set log="%temp%\wusa-%date:~-4,4%%date:~-7,2%%date:~-10,2%-%time:~-11,2%%time:~-8,2%%time:~-5,2%.log"

echo.
echo Installing updates from "%~dp0"
echo.

for /r "%~dp0" %%m in ("Windows%ver%*%arch%*.msu") do (
set msupath=%%m
set msufile=%%~nm
call :wusa
)
echo.
echo Done! Please check %log% for results.
echo.
pause
goto :eof

:wusa
echo %msufile%
start /wait "%SystemRoot%\System32\wusa.exe" "%USERPROFILE%\Desktop\Windows Updates" /quiet /norestart
echo %msufile% %errorlevel% >> %log%

Nothing is happening. I think I am doing something wrong but I am unable to find it out. Please help me.

Link to comment
Share on other sites


  • Replies 1
  • Views 1.1k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...