Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Determine version of Windows

Determine version of Windows

Determine version of Windows

I need to determine the version of windows that my compiled QB4.5 program is running under.  In my program, I am shelling out to run a batch file that is created from within the program.  In order to run the programs properly from the batch file, I need to specify either the use of COMMAND for Win9x or CMD for WinXP.  For this reason, I need to determine the version of windows so that I can shell properly.  Any suggestions?

RE: Determine version of Windows

In windows there is 1 or more API calls that can be used to
find the OS.

for Qbasic try
shell "ver"

or shell "ver >my.fil"
open "my.fil" for input as #1
while not eof(1)
 line input #1,LL$
 if LL$<>"" then OS$=LL$

RE: Determine version of Windows

That's great and a big duh on my part.  But now I have another question:  How can I tell if I am running in a DOS window under Win9x or if the computer was booted to only DOS, where I can't run other programs from my quickbasic program such as Adobe Acrobat?  The VER command returns the same response either in a DOS window or when booted to Win98se DOS.

RE: Determine version of Windows

I suspect that would have to be a windows program calling some api, finding the "window" but then if you are running in 98 dos ....

Perhaps, If you have a little win program, maybe it will
return an error if running in booted dos mode

RE: Determine version of Windows

windows xp/nt still have the command program in addition to the cmd program so you don't really need to worry about this - (all versions of windows have the command program)

%, 2004

RE: Determine version of Windows

Here's my suggestion:


'--Get OS info.  (Thanks to Buff1)
SHELL "ver > Temp.fil"
OPEN "temp.fil" FOR INPUT AS 11
    LINE INPUT #11, Aline$
    IF Aline$ <> "" THEN OS$ = Aline$
KILL "temp.fil"

'--Get global variable.  (Per MiggyD)
WinOpen$ = ENVIRON$("windir")
WinOn$ = "Windows Running?: "
IF LEN(WinOpen$) > 1 THEN
    WinOn$ = WinOn$ + "Yes, most likely"
    WinOn$ = WinOn$ + "Most likely DOS"

'--Display Info
PRINT "Operating System: "; OS$

'--Write down info
OPEN "Answers.txt" FOR APPEND AS 14
PRINT #14, "Operating System: "; OS$
PRINT #14, WinOn$
PRINT #14,

 Following is from the "Answers.txt" it generated:


Operating System: Windows 95. [Version 4.00.1111]
Windows Running?: Most likely DOS

Operating System: Windows 98 [Version 4.10.1998]
Windows Running?: Most likely DOS

Operating System: Windows Millennium [Version 4.90.3000]
Windows Running?: Yes, most likely

Testing Info:
I'm currently on Win ME (which doesn't allow: Start in DOS mode).

I have both a '95 and a '98 Boot disk. Started system from floppies (which generated the first two results--sorry, I don't plan on finding a spare drive and re-installing either of these, you'll have to test this out on your own.)

This code was NOT tested on an NT or XP system.  Results obtained may vary or be inconclusive {see below}.
--end test info--

I Hope This Helps you.  Be cautious!  In XP there's the capability to "do not let program detect running under windows" (or something to that effect.)

Again, HTH.

RE: Determine version of Windows

You are incorrect


I'm currently on Win ME (which doesn't allow: Start in DOS mode).

Windows ME does allow booting to dos you have to use the magic button F8

%, 2004

RE: Determine version of Windows

Ummm, no I am not "incorrect"...

I used your "magic" button and this is what I got:


1) Normal
2) Start Bootlog.txt
3) Safe Mode
4) Step-by-Step confirmation

At the bottom it said:


F5 for Safe Mode, Shift-F8 for Step Confirmation.

I'm pretty certain I would not have stated that without first checking my system.  Maybe there's a different build of ME (or an "Upgrade to ME") that you used. Don't know, don't matter.  As I said before, "you'll have to test this out on your own."  I was only giving you the results per the current machine I was on.

Good luck,

RE: Determine version of Windows

-- WinME sucks --

XP allows Dos boot... BUT... it loads windows first...
(so what's the point... right?)

You have to log on to go to the Dos Mode...

If you are still using WinME... WHAT IS WRONG WITH YOU ???


Good Luck,

[b][color blue]Have Fun, Be Young... Code BASIC


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.

RE: Determine version of Windows

XP allows a DOS boot?  How do you do this?

The best way to use dos is to use a boot floppy disk.  Find an old computer, running Win 3.1, go to the File Manager and tell it to make a boot disk.

RE: Determine version of Windows

If you do this then you won't beable to access your harddrive unless it is FAT32(although by default windows is installed on NTFS which you would need a third party program in order to read NTFS in dos
sysinternal.com make a program called NTFSDos
which they have two version
1). Is Free but it will only let you have read-only access to your harddrive.
2). You have to pay for and you get full access.

%, 2004

RE: Determine version of Windows

In XP you can use the magic F8 and boot to the command prompt in safe mode. Perhaps that's what is meant.

I just had an occurance to do that with a computer plagued
by worms and such.

BTW, I have a client running XP at his office and it seems to get viruses (like maybe 5 per day) whereas the W98 I have here doesnt with the same antivirus and same firewall.

Any ideas anyone ?

RE: Determine version of Windows

First boot into safe mode
login as the admin
disable system restore
go to the c drive go to the propertys of this folder "System Volume Information"
go to the security tab
give all the users on the system full permission for this folder(go to advanced check the box starting with Replace~1) click ok, click ok
^this is a location on xp that viruses like to hide since by default windows does not give any user on the system access to this dir(so when you do a virus scan the program can not search here because none of the users have permissions to access this directory).

go to this location C:\Documents and Settings
go to these locations and delete the contents of each folder
C:\Documents and Settings\username\Cookies
C:\Documents and Settings\username\Local Settings\Temp
C:\Documents and Settings\username\Local Settings\Temporary Internet Files


These are alot of locations that viruses hide
also this person might have p2p software which is where the main way viruses are spread.

Also make sure that windows has all of the lastest patches

%, 2004

RE: Determine version of Windows

after you do this reboot to safemode with networking then try going here

click "Scan Now. It's Free!"
check auto fix then have it scan the harddrive
then you should be done although you may want to also use software that is specificly for adware/spyware a very good one is ad-aware(made by Lavasoft) they have a free version

%, 2004

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close