#7928 - 2001-04-03 06:10 PM
Windows 2000 OS identifier
|
Anonymous
Anonymous
Unregistered
|
Here's a simple question from a simple mind.You are familiar with the statement: IF "%OS%" == "windows_NT" What is the correct identifier for Windows 2000?
|
Top
|
|
|
|
#7929 - 2001-04-03 08:12 PM
Re: Windows 2000 OS identifier
|
Anonymous
Anonymous
Unregistered
|
If you are using kiXtart, just use the macrosSELECT ; Checks what OS you are running. CASE ((@INWIN = 1) AND (@DOS = 5.0)) $OS = "Win2K" CASE ((@INWIN = 1) AND (@DOS = 4.0)) IF $Systype = "LanmanNT" OR $SysType = "ServerNT" $OS = NT4server ELSE $OS = "NT4wksta" ENDIF CASE ((@INWIN = 2) AND (@DOS >= 4.10)) $OS = "Win98" CASE ((@INWIN = 2) AND (@DOS = 4.0)) $OS = "Win95" ENDSELECT Travis
|
Top
|
|
|
|
#7930 - 2001-04-03 10:10 PM
Re: Windows 2000 OS identifier
|
cmarti
Hey THIS is FUN
Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
|
2000 machines will also have an entry 'Microsoft Windows 2000" in the registry at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName")
|
Top
|
|
|
|
#7932 - 2001-10-29 07:02 PM
Re: Windows 2000 OS identifier
|
Anonymous
Anonymous
Unregistered
|
What about if you want to test for 2K in DOS (logon.bat) instead of in Kixtart?
|
Top
|
|
|
|
#7933 - 2001-10-29 08:22 PM
Re: Windows 2000 OS identifier
|
Les
KiX Master
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
The output of VER will show: C:\>ver
Microsoft Windows 2000 [Version 5.00.2195] C:\> Pipe it to Find, and Bob's your uncle.
[ 29 October 2001: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
Top
|
|
|
|
#7934 - 2001-10-29 10:45 PM
Re: Windows 2000 OS identifier
|
Anonymous
Anonymous
Unregistered
|
What do you mean with "Pipe it to Find"?Martijn
|
Top
|
|
|
|
#7936 - 2001-10-30 11:22 AM
Re: Windows 2000 OS identifier
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
mmletzko,No need to shell out or run another program to locate Windows 2000. This batch file should do the trick. code:
@ECHO OFF if not "%ALLUSERSPROFILE%" == "" goto found GOTO END:FOUND ECHO Found Windows 2000 REM Or what ever command you want to run. GOTO END :END
The environment variable %ALLUSERSPROFILE% should not exist on any of the other Windows OS types. Martijn, Pipe normally means to redirect the output to another program to perform another task with it. However, using this batch file it is not needed. HTH... [ 30 October 2001: Message edited by: NTDOC ]
|
Top
|
|
|
|
#7938 - 2001-11-05 10:21 AM
Re: Windows 2000 OS identifier
|
Anonymous
Anonymous
Unregistered
|
NTDOC,This seems to work. I added a sub to test if win2k is not found. I tested this on a win95-machine and an Nt-server-machine. It's a simple but yet effective test. Here's the batch I tested: code:
@Echo OFF If not "%ALLUSERSPROFILE%" == "" Goto FOUND If "%ALLUSERSPROFILE%" == "" Goto NOTFOUND Goto END:FOUND Echo Found Windows 2000 Pause Goto END :NOTFOUND Echo Windows 2000 not found Pause Goto END :END
Martijn
|
Top
|
|
|
|
#7940 - 2001-11-06 09:18 AM
Re: Windows 2000 OS identifier
|
chaicka
Lurker
Registered: 2001-11-06
Posts: 1
|
How about Windows XP?If I have not remember wrongly, winXP cannot recognize an "If" statement. I tried with a simple batch file, and it failed.
|
Top
|
|
|
|
#7941 - 2001-11-06 10:57 PM
Re: Windows 2000 OS identifier
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Hello chaicka,Please give this a try and let me know how it goes. The following code can be used to find the current release version of Windows XP from a batch file. This may need to be altered for other non English languages and/or when XP is updated. NOTE: The line to check for Windows 9x must be first otherwise you'll get an error because Windows 9x does not understand the FOR command as used here code:
@ECHO OFF IF NOT "%OS%" == "Windows_NT" GOTO WIN9X for /f "Tokens=*" %%i in ('ver') do ( IF "%%i" == "Microsoft Windows XP [Version 5.1.2600]" GOTO XP) IF not "%ALLUSERSPROFILE%" == "" GOTO WIN2K IF "%OS%" == "Windows_NT" GOTO NT4 GOTO END:XP ECHO Found Windows XP REM Or what ever command you want to run. GOTO END :WIN2K ECHO Found Windows 2000 REM Or what ever command you want to run. GOTO END :NT4 ECHO Found Windows NT 4 REM Or what ever command you want to run. GOTO END :WIN9X ECHO Found Windows 9x REM Or what ever command you want to run. GOTO END :END
Please post your test results. All my batch files still work in XP so I don't think it is something caused by XP. [ 06 November 2001: Message edited by: NTDOC ]
|
Top
|
|
|
|
#7942 - 2001-11-08 07:34 PM
Re: Windows 2000 OS identifier
|
Pelussa
Lurker
Registered: 2001-11-08
Posts: 1
|
How to Determine the OS Type in a Logon Script PSS ID Number: Q190899 Article last modified on 12-15-2000 WINDOWS:; Win2000:95; winnt:3.51,4.0 ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Windows NT Server versions 3.51, 4.0 - Microsoft Windows NT Workstation versions 3.51, 4.0 - Microsoft Windows NT Server, Enterprise Edition version 4.0 - Microsoft Windows NT Server version 4.0, Terminal Server Edition - Microsoft Windows 95 - Microsoft Windows 98 ------------------------------------------------------------------------------- SUMMARY ======= Often, administrators would like to run software on only their Windows 95 or Windows 98 clients, or their Windows NT Workstation clients. They may not want to run some logon script commands on their Windows NT Server computers or domain controllers. MORE INFORMATION ================ Using a simple batch file and a small executable file, you can tell if the client is a: - Windows 95 or Windows 98 client - Windows NT workstation - Windows 2000 Professional installation - Windows NT Server non-domain controller - Windows 2000 Server non-domain controller - Windows NT Server domain controller - Windows 2000 Server domain controller - Windows NT Enterprise/Terminal Server domain controller - Windows NT Enterprise/Terminal Server non-domain controller Copy the following text to a batch file: @echo off REM Batch file to detect OS REM ---------------------------------- if Windows_NT == %OS% goto WINNT echo You are not running Windows NT (Windows 95/98 perhaps?) goto END :WINNT gettype.exe if errorlevel=9 goto FILENOTFOUND echo You are running Windows NT. echo More Specifically: echo. if ERRORLEVEL=8 goto EIGHT if ERRORLEVEL=7 goto SEVEN if ERRORLEVEL=6 goto SIX if ERRORLEVEL=5 goto FIVE if ERRORLEVEL=4 goto FOUR if ERRORLEVEL=3 goto THREE if ERRORLEVEL=2 goto TWO if ERRORLEVEL=1 goto ONE :FILENOTFOUND echo. echo Gettype not found. echo. goto END :EIGHT echo Windows NT Enterprise/Terminal Server Non-Domain Controller goto END :SEVEN echo Windows NT Enterprise/Terminal Server Domain Controller goto END :SIX echo Windows 2000 Server Domain Controller goto END :FIVE echo Windows NT Server Domain Controller goto END :FOUR echo Windows 2000 Server Non-Domain Controller goto END :THREE echo Windows NT Server Non-Domain Controller goto END :TWO echo Windows 2000 Professional installation goto END :ONE echo Windows NT Workstation goto END :END pause Copy the Gettype.exe file and the batch file to the target workstations and run the batch file. You can obtain Gettype.exe version 4.0 from Microsoft Product Support Services. Gettype.exe works by querying the registry for the installation type and setting the DOS ERRORLEVEL appropriately: - Returns 1 for Windows NT Workstation. - Returns 2 for Windows 2000 Professional. - Returns 3 for Windows NT Server non-domain controller. - Returns 4 for Windows 2000 Server non-domain controller. - Returns 5 for Windows NT Server domain controller. - Returns 6 for Windows 2000 Server domain controller. - Returns 7 for Windows NT Enterprise/Terminal Server domain controller. - Returns 8 for Windows NT Enterprise/Terminal Server non-domain controller. Silent mode can be set with the /s parameter. This tool can also be run against remote computers.
|
Top
|
|
|
|
#7944 - 2001-11-09 01:17 AM
Re: Windows 2000 OS identifier
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
GETTYPE would require the use of the utility from the Resource Kit.Has anybody seen the Resource Kit from XP yet? Doc - I took your code and modified it.
code:
::@ECHO OFF IF NOT "%OS%" == "Windows_NT" GOTO WIN9XVER|FIND /I "2000" && IF %ERRORLEVEL% EQU 0 GOTO WIN2K || FIND /I "XP" && IF %ERRORLEVEL% EQU 0 GOTO XP IF "%OS%" == "Windows_NT" GOTO NT4 GOTO END :XP ECHO Found Windows XP REM Or what ever command you want to run. GOTO END :WIN2K ECHO Found Windows 2000 REM Or what ever command you want to run. GOTO END :NT4 ECHO Found Windows NT 4 REM Or what ever command you want to run. GOTO END :WIN9X ECHO Found Windows 9x REM Or what ever command you want to run. GOTO END :END PAUSE
Thanks! - Kent
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 980 anonymous users online.
|
|
|