PC Review


Reply
Thread Tools Rate Thread

how can i tell if a OS is WinXP WITH SP2?

 
 
Gill Bates
Guest
Posts: n/a
 
      26th Nov 2004
how can i tell if a OS is WinXP WITH SP2?

Using ver, find and simples tools

now, i'm using:

ver | find "XP"
if errorlevel 1 goto WRONGOS


But i would like to certify the SP level




 
Reply With Quote
 
 
 
 
Paul R. Sadowski [MVP]
Guest
Posts: n/a
 
      26th Nov 2004
Hello, Gill:
On Fri, 26 Nov 2004 17:35:39 -0200: you wrote...

GB>
GB> Using ver, find and simples tools
GB>
GB> now, i'm using:
GB>
ver |> find "XP"
GB> if errorlevel 1 goto WRONGOS
GB>

After determinig that it is XP the I believe these checks will work:
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion
| find "Service Pack 2"
echo %ERRORLEVEL%
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Windows" /v CSDVersion |
find "0x200"
echo %ERRORLEVEL%

Regards, Paul R. Sadowski [MVP].


 
Reply With Quote
 
Bill Stewart
Guest
Posts: n/a
 
      26th Nov 2004
Gill Bates wrote:

> how can i tell if a OS is WinXP WITH SP2?
>
> Using ver, find and simples tools
>
> now, i'm using:
>
> ver | find "XP"
> if errorlevel 1 goto WRONGOS
>
> But i would like to certify the SP level


You could try my osverex.exe:

http://home.comcast.net/~stewartb/wast.html

--
Bill Stewart
 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      27th Nov 2004
When executed within a shell script, this will set an environment
variable to the service pack major version -

for /f %%v in ('wmic os get servicepackmajorversion /value') do set %%v

.... output needs a little tidying up but I'm sure you get the idea.

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l

Gill Bates wrote:
> how can i tell if a OS is WinXP WITH SP2?
>
> Using ver, find and simples tools
>
> now, i'm using:
>
> ver | find "XP"
> if errorlevel 1 goto WRONGOS
>
>
> But i would like to certify the SP level



 
Reply With Quote
 
Clay Calvert
Guest
Posts: n/a
 
      27th Nov 2004
On Fri, 26 Nov 2004 19:01:32 -0500, "Dean Wells [MVP]"
<(E-Mail Removed)> wrote:

>When executed within a shell script, this will set an environment
>variable to the service pack major version -
>
>for /f %%v in ('wmic os get servicepackmajorversion /value') do set %%v
>
>... output needs a little tidying up but I'm sure you get the idea.


The following is one line.

for /f "tokens=2 delims==" %%v in (
'wmic os get servicepackmajorversion /value ^| find "ServicePack"'
) do if %%v LSS 2 echo Too Low

WMIC, Reg, SC and even Regini make managing XP and 2003 much easier
than NT and 2000 boxes, at least for me it does.

Clay Calvert
(E-Mail Removed)
Replace "W" with "L"
 
Reply With Quote
 
guard
Guest
Posts: n/a
 
      27th Nov 2004
"Gill Bates" wrote
> how can i tell if a OS is WinXP WITH SP2?
>
> Using ver, find and simples tools
>
> now, i'm using:
>
> ver | find "XP"
> if errorlevel 1 goto WRONGOS
>


> But i would like to certify the SP level


Here are a few self-documenting variations
using the FREE Advanced Command Library and
Mount/\Commands. All of them work CONSISTENTLY
on any NT-based OS, out of the box.

Use the code that makes your script the
most readable. For example:

CALL ntlib.cmd /q :SI
%.ifNotXP% GOTO :Wrong_OS
IF %#ServicePack% LSS 2 GOTO :Wrong_ServicePack

*******

CALL ntlib.cmd /Quiet :System_Info
%.ifXP% (
IF %#ServicePack% EQU 2 (
ECHO:XP with Service Pack 2
)
)

*******

CALL ntlib.cmd /Q :SI
%.ifXP% (
IF NOT %#ServicePack% EQU 2 (
ECHO:SP2 not found
)
) ELSE (
ECHO:Not Windows XP
)

*******

CALL ntlib.cmd /q :SI
%.ifNotXP% (
ECHO:Not XP
) ELSE (
IF NOT %#ServicePack% EQU 2 (
ECHO:XP with Service Pack %#ServicePack%
) ELSE (
ECHO:XP with SP2
)
)

*******

For more information and examples, see
(http://TheSystemGuard.com/MtCmds/IfCondition/ifXP.htm)
(http://TheSystemGuard.com/NTCmdLib/Procedures/SI.htm)
(http://thesystemguard.com/NTCmdLib/GlobalSwitches)
(http://TheSystemGuard.com/NTCmdLib/Constants)

For cross-platform command references, see
(http://TheSystemGuard.com/TheGuardBook/CCS-Int/CALL.htm)
(http://TheSystemGuard.com/TheGuardBook/CCS-Int/ECHO.htm)
(http://TheSystemGuard.com/TheGuardBook/CCS-Int/GOTO.htm)
(http://TheSystemGuard.com/TheGuardBook/CCS-Int/IF.htm)

*******

ifXP, ifNotXP and over 150 other commands are included in
the FREE Advanced NT/2K/XP/K3 Command Library (ntlib.cmd).

Request your copy at (http://ntlib.com).

*******

What is a .Mount/\Command?

An optimized section of cross-platform shell scripting
code that is stored in an environment variable under a
"sounds like what it does" name. Only builtin commands
common to all four platforms (NT/2K/XP/K3) are used.
There is NO BINARY CODE, only scripting code.

Since the code is "cached" in the local environment,
performance is similar to native commands like FOR,
DIR, etc. One call to the library at the beginning
of your script preloads all 150+ "Mounted Commands".

-tsg

/-----------------+---------------+----------------------\
| COMPATIBILITY | CLARITY | SPEED |
| Write code ONCE | Make it clear | THEN...Make it fast! |
\-----------------+---------------+----------------------/
400+ command-line resources using ONLY native NT commands!
(http://TheSystemGuard.com/default.asp#MasterCommandList)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WinXP ATA drive to WinXP SATA migration: options and ideas needed =?Utf-8?B?VG9t?= Windows XP Setup 2 27th Sep 2007 10:26 PM
WinXP Home transition from prior WinXP Pro and Win98 dual-boot pro =?Utf-8?B?TGFycnkgQm9i?= Windows XP Setup 1 15th Sep 2005 12:50 AM
WinXP Home, WinXP Pro Peer Server and group based security Gordon Windows XP General 0 22nd Apr 2005 10:11 PM
multiboot configuration - WinXP Home, WinXP Professional, Fedora Linux, Windows 2003 Server Clint Maxwell Windows XP Help 1 25th Mar 2004 08:53 PM
Remote access win2000 -> winXP (or WinXP->WinXP) marius Windows XP Networking 1 12th Nov 2003 07:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:09 AM.