Page 1 of 1 1
Topic Options
#35554 - 2003-01-23 10:38 AM How best to determine OS?
R. Baker Offline
Fresh Scripter

Registered: 2003-01-23
Posts: 7
I am writing a script to copy files to client PCs. I have to put the files in different directories depending on the operating system. I need to cater for everything from Win95, 98, ME, 2K and XP. "INWIN" seems to be inadequate. Is there a way to find this out?

Thanks,

R. Baker

Top
#35555 - 2003-01-23 11:43 AM Re: How best to determine OS?
Dunc Offline
Getting the hang of it

Registered: 2002-05-25
Posts: 54
Loc: Guildford England
Hello

What version of kix asre you using? If you are using kix 4.* then you can use the @productType macro.

Duncan

Top
#35556 - 2003-01-23 02:37 PM Re: How best to determine OS?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
also, what the directory is?

if you only want to copy to program files folder or to windows directory, there is allways general ways of doing that...

as example, all windows versions should support:
%windir%

as the systems root directory.
_________________________
!

download KiXnet

Top
#35557 - 2003-01-23 02:40 PM Re: How best to determine OS?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
If you need a batch file, try this...
code:
@ECHO OFF
IF NOT "%OS%" == "Windows_NT" GOTO WIN9X
VER|FIND /I "XP" >NUL && IF %ERRORLEVEL% EQU 0 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
ECHO You should see this on Windows ME
pause
REM Or what ever command you want to run.
GOTO END
:END

_________________________
We all live in a Yellow Subroutine...

Top
#35558 - 2003-01-23 02:42 PM Re: How best to determine OS?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
One should never ever assume a certain directory structure based on OS alone. Better always to read the values from the registry.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#35559 - 2003-01-23 02:54 PM Re: How best to determine OS?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Another option is to use the Macros - @PRODUCTTYPE and/or @PRODUCTSUITE...

For example with @PRODUCTTYPE:
quote:

OS type. Possible values:
"Windows 95"
"Windows 98"
"Windows Me"
"Windows NT Workstation"
"Windows NT Server"
"Windows NT Domain Controller"
"Windows 2000 Professional"
"Windows 2000 Server"
"Windows 2000 Domain Controller"
"Windows XP Home Edition"
"Windows XP Professional"
"Windows .Net Server"
"Windows .Net Domain Controller"

If you are not running Kix 4.x or better, you can also use - http://home.wanadoo.nl/scripting/download/os.kix

HTH,

Kent

[ 23. January 2003, 14:56: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#35560 - 2003-01-23 03:33 PM Re: How best to determine OS?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Or you check out the UDF Fourm, e.g. OSID() - Identifies operating system, service pack level, and OS kernel
_________________________
There are two types of vessels, submarines and targets.

Top
#35561 - 2003-01-23 07:28 PM Re: How best to determine OS?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Jens' UDF mentioned above does quite well at recognizing flavours of Win95 & Win98. This often important because the differences between Win95a & Win95b are greater than the differences between Win95c & Win98. I recommend it.
_________________________
Jack

Top
#35562 - 2003-01-23 07:31 PM Re: How best to determine OS?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I still must ask from R what he wants to do with that info.

he might be doing stuff what does not in any way require the info about OS
_________________________
!

download KiXnet

Top
#35563 - 2003-01-23 07:54 PM Re: How best to determine OS?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
SInce everyone is getting into this, I thought I'd get on too.

Is the copy going remotely (i.e. push the files out to the remote PC) or from a script running local on the PC.

If it is local, then you may have security issues copying to %windir%.

But since the poster has abandoned the thread, it may be time to get off now... [Smile]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#35564 - 2003-01-23 08:04 PM Re: How best to determine OS?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Do I detect a note of sarcasm? You know, most of the frequent posters never let the fact the poster has departed stop them from joining in on the conversation. It what makes the board fun. [Big Grin]
_________________________
Jack

Top
#35565 - 2003-01-23 08:09 PM Re: How best to determine OS?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
well... we do love to hear ourselves speak...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#35566 - 2003-01-23 08:12 PM Re: How best to determine OS?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
who we?

I hate my own talk but I believe I'm responsible of keeping the world alive with my speech...
speech that can do wonders!

as you can see from my postcount [Wink]
_________________________
!

download KiXnet

Top
#35567 - 2003-01-23 08:15 PM Re: How best to determine OS?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
If you spoke as much as you type, you might be a huge contributer to green house gasses [Big Grin]

No Lonk, that is not the way to bring an early spring to Finland.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#35568 - 2003-01-23 08:21 PM Re: How best to determine OS?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I like to think that I contribute to the needs of the trees. [Big Grin]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#35569 - 2003-01-23 08:27 PM Re: How best to determine OS?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
rad, have you checked our temp?
it was some days on the plus side and probably will be for some days from here...

my writings have done some real difference.
you can check also the canadians who are living in iglus now!

right on spring!
_________________________
!

download KiXnet

Top
#35570 - 2003-01-23 09:17 PM Re: How best to determine OS?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Yes, it is certainly cold here right now.
_________________________
Jack

Top
#35571 - 2003-01-23 09:19 PM Re: How best to determine OS?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
this is no place for a brass monkey. [Frown]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#35572 - 2003-01-23 09:23 PM Re: How best to determine OS?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it is getting the coldest is has been here in several years...

They say it will drop below freezing for most of the local region sometime tonight.

I have to go out and cover my orange and lime trees so the frost won't kill the leaves.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#35573 - 2003-01-23 09:27 PM Re: How best to determine OS?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Here, we test the ice on the river to see if it deep enough to drive on. (It is.)
_________________________
Jack

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.105 seconds in which 0.058 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org