• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Installing locally multiple patches

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
onebulgar
Asked:
onebulgar
  • 6
  • 4
2 Solutions
 
Burns2007Commented:
@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
 
onebulgarAuthor Commented:
It creates the file  (pathces.txt) but it says "File Not Found" when I run it from cmd.
0
 
onebulgarAuthor Commented:
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
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
SteveGTRCommented:
No points to me.

Just quote the executable:

"%%i" /quiet /norestart
0
 
onebulgarAuthor Commented:
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
 
SteveGTRCommented:
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
 
onebulgarAuthor Commented:
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
 
onebulgarAuthor Commented:
You are the man Steve!

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

Thanks
0
 
SteveGTRCommented:
@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
 
onebulgarAuthor Commented:
Thanks! SteveGTR and Burns2007
0
 
SteveGTRCommented:
Glad it worked :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now