Code to get some important folder path and OS Version

Below code will help to get the important folder path and OS Version
VB.NET Code
Dim PersonalDir As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Dim CookiesDir As String = Environment.GetFolderPath(Environment.SpecialFolder.Cookies)
'Path of the Exe
Dim Location As String = System.Reflection.Assembly.GetExecutingAssembly().Location
Dim os As OperatingSystem
os = Environment.OSVersion
MessageBox.Show(os.Version.ToString()) 'OS Version
MessageBox.Show(os.Platform.ToString()) 'OS Platform

C#.NET Code
string PersonalDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string CookiesDir = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);
//Path of the Exe
string Location = System.Reflection.Assembly.GetExecutingAssembly().Location;
OperatingSystem os = default(OperatingSystem);
os = Environment.OSVersion;
MessageBox.Show(os.Version.ToString()); //OS Version
MessageBox.Show(os.Platform.ToString()); //OS Platform

No comments:

Post a Comment