Jump to content

Getting windows version using c++

Go to solution Solved by Unimportant,
5 hours ago, Shammikit said:

im trying to get the windows OS version (eg: professional,ultimate,home,etc) using c++. i have already done some searching but the only thing that i came across are codes where people would write some if conditions and printf statements like: printf("windows 10"). im trying to get the entire windows name including its version like (windows 10 home). how can i achieve this

It can be done with WMI, getting data from the Win32_OperatingSystem class

 

Here's an example, using c++: https://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx

Extremely convoluted, for such as simple task, in the usual microsoft way.

im trying to get the windows OS version (eg: professional,ultimate,home,etc) using c++. i have already done some searching but the only thing that i came across are codes where people would write some if conditions and printf statements like: printf("windows 10"). im trying to get the entire windows name including its version like (windows 10 home). how can i achieve this

Link to comment
https://linustechtips.com/topic/857280-getting-windows-version-using-c/
Share on other sites

Link to post
Share on other sites

1 hour ago, Shammikit said:

im trying to get the windows OS version (eg: professional,ultimate,home,etc) using c++. i have already done some searching but the only thing that i came across are codes where people would write some if conditions and printf statements like: printf("windows 10"). im trying to get the entire windows name including its version like (windows 10 home). how can i achieve this

Why is it a problem to get major and minor version and choose the name on your version name based on that? Also, what if OS is not Windows?

Try, fail, learn, repeat...

Link to post
Share on other sites

5 hours ago, Shammikit said:

im trying to get the windows OS version (eg: professional,ultimate,home,etc) using c++. i have already done some searching but the only thing that i came across are codes where people would write some if conditions and printf statements like: printf("windows 10"). im trying to get the entire windows name including its version like (windows 10 home). how can i achieve this

It can be done with WMI, getting data from the Win32_OperatingSystem class

 

Here's an example, using c++: https://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx

Extremely convoluted, for such as simple task, in the usual microsoft way.

Link to post
Share on other sites

10 hours ago, zwirek2201 said:

Why is it a problem to get major and minor version and choose the name on your version name based on that? Also, what if OS is not Windows?

at the moment im trying for windows only. about the major and minor version, it doesn't tell what version of the OS u have right?(like if we have PRO, ultimate or home version) from what i saw using major and minor we have to manually compare the major and minor and print the OS like: if major is 6 and minor is 0 then print windows 8. i tried to get major and minor and i got major 6 and minor as 2. i found this table on stack overflow  which had all majors and minors and i saw it had major 6 and minor 2 for windows 8 and windows 10 is major 10 and minor 0 according to that table. im here running windows 10. how is that possible

Link to post
Share on other sites

6 hours ago, Unimportant said:

It can be done with WMI, getting data from the Win32_OperatingSystem class

 

Here's an example, using c++: https://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx

Extremely convoluted, for such as simple task, in the usual microsoft way.

thanks this helped

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

×