Solved

Using a FOR Loop to install multiple patches

Posted on 2009-05-10
4
758 Views
Last Modified: 2012-05-06
I have a location where the OS install files are located and want to slipstream these patches. Can you help me for a LOOP which would treat any number of these hotfixes exactly like the four examples below.
(Some kind of FOR Loop which would target all the patches in the %patchpath%)
Or maybe Powershell or VBS would be better?
Thank you!
JohnD
set baseXPpath=X:\i386
set patchpath=X:\i386\patches
%patchpath%\WindowsXP-KB834707-x86-enu.exe /integrate:%baseXPpath%
%patchpath%\WindowsXP-KB885836-x86-ENU.exe /integrate:%baseXPpath%
%patchpath%\WindowsXP-KB873339-x86-ENU.exe /integrate:%baseXPpath%
%patchpath%\WindowsXP-KB885835-x86-ENU.exe /integrate:%baseXPpath%

Open in new window

0
Comment
Question by:johndarby
  • 2
  • 2
4 Comments
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 500 total points
ID: 24351095
First, why not use nLite to do this?  www.nliteos.com

Put the Patch Names into a text file - for example:

Patches.txt:
-------------------
WindowsXP-KB834707-x86-enu.exe /integrate:%baseXPpath%
WindowsXP-KB885836-x86-ENU.exe /integrate:%baseXPpath%
WindowsXP-KB873339-x86-ENU.exe /integrate:%baseXPpath%
WindowsXP-KB885835-x86-ENU.exe /integrate:%baseXPpath%
-------------------

Then the batch file would be as below:
set baseXPpath=X:\i386
set patchpath=X:\i386\patches
for /f "tokens=*" %%a in (patches.txt) Do %patchpath%\%%a

Open in new window

0
 
LVL 1

Author Comment

by:johndarby
ID: 24351206
Very cool tool (nLite)! I want to have portability for working from a USB stick and the script above is helpful. Do I need to add the /INTEGRATE switch as well, like this...

set baseXPpath=X:\i386
set patchpath=X:\i386\patches
for /f "tokens=*" %%a in (patches.txt) Do "%patchpath%\%%a /integrate:X:\i386"
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 24351242
Honestly, don't know - I've only occasionally bothered creating a slipstreamed install (most of my clients get machines one at a time and maintaining an image for them doesn't generally make sense - and licensing prohibits me from creating a disk to use at multiple clients.  And when I have created the slipstreamed CDs, I've used nLite.
0
 
LVL 1

Author Closing Comment

by:johndarby
ID: 31580010
A great help with the FOR loop! Thank you!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question