본문 바로가기

스터디/C#.NET:자료

C#, 윈도우 버전 얻기

 

 

 

 

윈도우 버전 얻기

 

 

Code

 

 

 

 

 

private void frmMain_Load(object sender, EventArgs e)

{

 

OperatingSystem os = Environment.OSVersion;

Version v = os.Version;

 

if (5 == v.Major && v.Minor>0)

{

txtResult.Text += "Windows XP" + "\r\n";

}

else if (6 == v.Major && v.Minor == 0)

{

txtResult.Text += "Windows VISTA" + "\r\n";

}

else if (6 == v.Major && v.Minor == 1)

{

txtResult.Text += "Windows 7" + "\r\n";

}

else

{

txtResult.Text += "그 외 OS" + "\r\n";

}

 

txtResult.Text += os.ServicePack + "\r\n";

txtResult.Text += "Build : "+v.Build + "\r\n";

txtResult.Text += "Revision : " + v.Revision + "\r\n";

 

}

 

 

 

 

 

Result

 

 

 

출처: http://whiteat.com/59066