1

I'm developing an app for Windows 8, but I want to know if there's a way to know the version of Windows 8, because if it's Windows 8 RT I want the app only shows 2 options, for example, but if the app is running on Windows 8 Pro I want the app has the total functions.

I know when you create the packages in Visual Studio you can select the type or architecture you want for the app, but I don't know if with C# or JavaScript in the case of an app with HTML5 you can detect the architecture to know the version of Windows 8.

user247702
  • 23,641
  • 15
  • 110
  • 157
  • C# can read the registry. You should be able to get the OS version from the registry. I don't know if there's a way from JavaScript. – Doug Dawson May 01 '14 at 17:56

2 Answers2

2

I think you are mixing the meanings of architecture and OS version.
OS version you are looking for is actually a Windows Edition and it has nothing to do with CPU architecture.
As for your question, I think you are looking for this:

using System.Management;
var name = (from x in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType<ManagementObject>()
                      select x.GetPropertyValue("Caption")).FirstOrDefault();
return name != null ? name.ToString() : "Unknown";

taken from here

Regarding JavaScript I'm pretty sure that at least for now there is no way to know the edition.

Community
  • 1
  • 1
JeB
  • 11,653
  • 10
  • 58
  • 87
  • 1
    Just beware that WMI is very picky about just about everything. You need to be administrator, you need rights, sometimes it doesn't work for no reason, the planets have to align etc... etc... From experience, I would really suggest finding an alternate option than WMI. – Brandon May 01 '14 at 18:00
0

I don't know if the RT part comes through, but this blog has an example of extracting OS information using the kernel32.dll in C#.

chsarp411 Tutorial

Stackoverflow Posting

Community
  • 1
  • 1
Doug Dawson
  • 1,254
  • 2
  • 21
  • 37