batch file, determine which os - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 08-17-2004, 10:05 AM   #1 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default batch file, determine which os

I want to create a batch file that will determine which OS is running on the pc and run commands specifically for that OS.

I really only need for it to distinguish between 98 & 2k OSs. I was thinking that I would try to detect the folder 'documents and settings'. I tried to use the following line of code on an xp pc but it would produce the expected results.

@echo off
if exist "C:\documents and settings\nul" echo docs and settings exists
__________________

office politics is offline  
Old 08-17-2004, 10:29 AM   #2 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default

ok guys i figured it out, i can't use the long filename. so this line works

if exist c:\docume~1\nul echo doc and settings
__________________

office politics is offline  
Old 08-17-2004, 10:39 AM   #3 (permalink)
Monster Techie
 
HoLoCroN's Avatar
 
Join Date: Mar 2004
Location: Plant City, FL
Posts: 1,305
Default

How would you like the results displayed? On the screen or a txt file?

If you were to have the results displayed on the screen, try something like this.

On Screen
================================================

@echo on

winver

rem winver will tell windows to display the current OS version along with build and SP information. A window is activated showing you a graphical interface


================================================


If you want to have the results saved to a file try this.

Off Screen
================================================

@echo off

ver > version.txt

rem ver will tell the script to display the current OS version , > tells the script to send the results to the "version.txt" file (it will create this in the root directory by default) this is a variable so you can change the name of the file name or location if you'd like.




================================================
HoLoCroN is offline  
Closed Thread

Thread Tools
Display Modes

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




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 05:45 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.