Jump to content

Batch File Help


Recommended Posts

Hi,

Finally got my work batch file for patching up and running covering XPSp1 / XPSp2 / 3 version's of Office / Visio / Project.

Have a question though.

My script is now a meaty 14 pages long :blushing: . Is it possible to reduce my script in someway with regards to the following :

My Xp patches call the following

cd MS06-011

call XP.bat

cd..

cd MS06-014

call XP.bat

cd..

cd MS06-015

call XP.bat

cd..

cd MS06-018

call XP.bat

cd..

cd MS06-022

call XP.bat

cd..

etc.

All the way down to Ms07.

Any thoughts ?

Cheers in advance.

Zorg

Link to comment
Share on other sites


ouch. take all the executables and put them in one folder. Then use a for loop to loop through them all like Ywozl did for going trough the folders, or create a CMD file calling each on individually.

Link to comment
Share on other sites

Why not just use nLite to integrate the patches as well? Also, why does it file have its own directory?

Our base OSD build get's updated every three months with all MS patches. We are implementing ITMU within the next three months but need to continue patching our existing estate of 15000 machines.

Own dir for each patch just to make it easier to maintain.

This is a copy of a standard XP.bat file.

Echo off
%windir%\system32\reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB923694" /v Description | %windir%\system32\find.exe "923694" && goto out
%windir%\system32\reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Updates\Outlook Express 6\SP1\KB923694-OE6SP1-20061106.120000" /v Description | %windir%\system32\find.exe "923694" && goto out
%windir%\system32\reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion | %windir%\system32\find.exe "Service Pack 2" && goto xpsp2patch

:xppatch
KB923694_OE6.0sp1.exe /QUIET /NORESTART
goto end

:xpsp2patch
KB923694_SP2.exe /QUIET /NORESTART

:end
%windir%\system32\reg.exe add HKLM\Software\GDS\VersionControl\PatchControl /v Reboot_Pending /t REG_SZ /d 1 /f

:out
%windir%\system32\xcopy.exe /Y KB923694.exe c:\smsinstall
goto finish

:NotReq
%windir%\system32\xcopy.exe /Y KB923694NA.exe c:\smsinstall

:finish

These files are added for reporting purpose as our SMS server only reports on .EXE's. :realmad: due to bandwith issues.

%windir%\system32\xcopy.exe /Y KB923694.exe c:\smsinstall

%windir%\system32\xcopy.exe /Y KB923694NA.exe c:\smsinstall

Link to comment
Share on other sites

A quick example:
FOR /F "DELIMS=" %%? IN ('DIR/B/AD^|FINDSTR/I MS0[67]-[0-9]*') DO (
IF EXIST %%?\XP.BAT CALL %%?\XP.BAT)

Hi,

Could you explain the above script as it is not working correctly.

Cheers

Zorg

Link to comment
Share on other sites

Yes!

The batch searches the current directory for all directories named MS06-<any numbers> or MS07-<any numbers>. Any XP.bat file found in any matching directory is called.

I created a 'test setup' in order to verify that the batch works!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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