Solved

Installing locally multiple patches

Posted on 2007-03-29
11
246 Views
Last Modified: 2013-11-25
I would like to write up a fully working script that will install "all" MS 2003 patches within a specified directory (locally) and it should have /quiet /norestart options for all patches. The script should not care the naming convention of the .exe files. It should only care if there are .exe files, it should execute those with /q /n parameters.

The script could be written in vbscript or batch
@echo off
setlocal
set PATHTOFIXES=Drive:\update
%PATHTOFIXES%\*.exe /quiet /norestart
%PATHTOFIXES%\*.exe /quiet /norestart

0
Comment
Question by:onebulgar
  • 6
  • 4
11 Comments
 
LVL 14

Assisted Solution

by:Burns2007
Burns2007 earned 30 total points
ID: 18821175
@echo off
setlocal
set PATHTOFIXES=Drive:\update
dir %PATHTOFIXES%\*.exe /b >patches.txt
for /f "eol=; tokens=1*" %%i in (patches.txt) do (
%%i /quiet /norestart
)



This will export everything *.exe from "Drive:\update" to a text file, ti will then go through the text file lline by line and run
line1.exe /quiet /norestart
line2.exe /quiet /norestart
etc etc
0
 

Author Comment

by:onebulgar
ID: 18821368
It creates the file  (pathces.txt) but it says "File Not Found" when I run it from cmd.
0
 

Author Comment

by:onebulgar
ID: 18821376
Nevermind, my mistake. One last related question, what if file is called "patch sf3.exe" instead of patchsf3.exe. Currently, it will not work.

0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 30

Expert Comment

by:SteveGTR
ID: 18821503
No points to me.

Just quote the executable:

"%%i" /quiet /norestart
0
 

Author Comment

by:onebulgar
ID: 18821509
As a matter of fact, I just tried the script and it didn't work. I says, "xyz.exe is not recongized as an internal
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 18821517
Well then, how about this. Note, I replaced Drive with C for this batch file. You'll want to change it as necessary.

@echo off

setlocal

pushd "c:\update"

for /f "tokens=*" %%a in ('dir /b /a-d *.exe 2^>NUL') do "%%a" /quiet /norestart

popd
0
 

Author Comment

by:onebulgar
ID: 18821521
SteveGTR: You are right :)

to finish my previous email,...."xyz.exe is not recongized as an internal or external command, operable program or batch file." This happens when I run the script from the cmd. Ah! it is so close to being done!

0
 

Author Comment

by:onebulgar
ID: 18821532
You are the man Steve!

You got the points but, would it be possible if you can echo what it is doing....?

Thanks
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 220 total points
ID: 18821535
@echo off

setlocal

pushd "c:\update"

for /f "tokens=*" %%a in ('dir /b /a-d *.exe 2^>NUL') do echo Running %%a&"%%a" /quiet /norestart

popd
0
 

Author Comment

by:onebulgar
ID: 18821584
Thanks! SteveGTR and Burns2007
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 18821588
Glad it worked :)
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

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…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

733 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