Solved

Installing locally multiple patches

Posted on 2007-03-29
11
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

 
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
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…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

718 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