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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving the OS

Status
Not open for further replies.

w095968

Programmer
Nov 26, 2001
1
US
I need a way to retrieve the operating system from the host computer. I'm creating an install application and different things need to happen when it is WinNT vs. Win95. I know that I can use a Shell object to retrieve a NT or 2000 OS:
Dim wshSysEnv
Set wshSysEnv = objShell.Environment("PROCESS")
GetOS = wshSysEnv("OS")

But this will not tell me if it is a 95 machine. Any ideas on how to differentiate between the two machines?
 
In ASP just add:

<%what_u_need=request.servervariables(&quot;HTTP_USER_AGENT&quot;)%>

the os is somewhere in the what_u_need string, you just have to get it...


Have Fun...

Sharky99 >:):O>
 
I have done this when I was writing an installer that needed to find the Program Files directory:
Code:
Set objWshShell = CreateObject(&quot;WScript.Shell&quot;)
Set objEnvironment = objWshShell.Environment(&quot;PROCESS&quot;)
strProgramLocation = objEnvironment(&quot;ProgramFiles&quot;)
If strProgramLocation = &quot;&quot; Then
  'Win9x!
  strProgramLocation = &quot;C:\Program Files&quot;
End If
It IS a hack, and it can be wrong about the Win9x machine's Program Files directory since it just punts and makes an assumption. But it does seem to be reliable so far.

If you only need the OS type, you might try relying on the COMSPEC variable, which is almost certainly (99.999%) &quot;command.com&quot; for Win9x and nearly always (98%+) &quot;cmd.exe&quot; for NT machines.

If you find any *certain* method I'd like to know as well!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top