Jump to content
Sign in to follow this  
Brenton

A more up to date @OSVersion

Recommended Posts

Brenton

I tried to post this to example scripts but I don't seem to have permission...

Anyway, for those of you using Windows 7, you probably already figured out that @OSVersion returns "WIN_VISTA" for both Vista and Win7. I wrote a quick function that returns the correct value. Enjoy!

Func OSVersion()
    If @OSVersion = "WIN_VISTA" Then
        $version = FileGetVersion(@SystemDir & "\WinVer.exe");
        If StringLeft($version,3) = "6.0" Then
            Return "WIN_VISTA"
        Else 
            Return "WIN_7"
        EndIf
    Else
        Return @OSVersion
    EndIf
EndFunc

Share this post


Link to post
Share on other sites
Mat

You don't have permission becouse you don't have 5 posts, get a mod to move it...

that looks quite handy, Not that i'd have any use for it, winxp all the way! ^_^

Share this post


Link to post
Share on other sites
KaFu

Share this post


Link to post
Share on other sites
Brenton

The problem is that Microsoft decided to give Windows 7 a version number of 6.1.xxxx

(You would think that Windows "7" would have a version number of "7"...)

I don't know why they did that but that's the reason I put 6.0 for Vista.

Looking at Version-Info of my XP (5.1.26...) this might be more accurate in the long run ^_^...

StringLeft($version,2) = "6."

Share this post


Link to post
Share on other sites
dot45

The problem is that Microsoft decided to give Windows 7 a version number of 6.1.xxxx

(You would think that Windows "7" would have a version number of "7"...)

I don't know why they did that but that's the reason I put 6.0 for Vista.

They gave it a version of 6.1 because it is built on the same basic kernal as vista (6.0) they made changes to it, but it is not a rewrite, hence 6.1 and not 7.

7 will be the next major rewrite of the kernal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.