Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if SP4 is applied to Windows 2000 1

Status
Not open for further replies.

wlfpackr

IS-IT--Management
May 3, 2003
161
US
Hi all,

I'm writing a batch file to install a Windows patch on our company systems. This patch will only work on Windows 2000 if SP4 is applied. How can I check from within the batch program to see if SP4 has been installed? Is there a specific file that is unique to SP4?

=================
There are 10 kinds of people in this world, those that understand binary and those that do not.
 
I found this a while ago online, it will print the Service Pack, you will have to add the if statements to do what you want with it.

@echo off

SET SP=

START /WAIT REGEDIT.EXE /E "%Temp%.\%~n0.dat" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"

FOR /F "tokens=2 delims==" %%A IN ('TYPE "%Temp%.\%~n0.dat" ^| FIND /I "CSDVersion"') DO SET SP=%%~A

ECHO.%SP% | FIND /I "Service Pack" >NUL

echo %SP%

pause

---------------------------------------
 
Okay. I'm so close yet so far away. I'm using the following IF statement (combined with the above script) to skip down to another section if the user does not have SP4. However, it's not working. Can anyone tell me why? The %sp% value prints Service Pack 4 to the screen using the script rye provided.

IF NOT ("Service Pack 4")==(%SP%) Goto NOSP

=================
There are 10 kinds of people in this world, those that understand binary and those that do not.
 
Nevermind. I just needed quotation marks around the %sp% variable.

=================
There are 10 kinds of people in this world, those that understand binary and those that do not.
 
Ummm... You can also right click on My Computer then read
the System information tab that pops up. The service pack
info shows up right under the winders version info.

Microsoft Windows 2000
5.00.1295
Service Pack x

-Maj
 
Or run winmsd from the command prompt.

-------------------------------

If it doesn't leak oil it must be empty!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top