How to determine which operating system is running?
Use System.Environment's OSVersion static (shared) property.
OperatingSystem
os = Environment.OSVersion;
MessageBox.Show(os.Version.ToString());
MessageBox.Show(os.Platform.ToString());
How
to get a file's extension from the complete path string?
Use
System.IO.Path.GetExtension static method.
How to get a file's name from the complete path string?
Use
System.IO.Path.GetFileName
and
System.IO.Path.GetFileNameWithoutExtension
static methods.
How to get the path for "My Documents" and other system
folders?
Use the GetFolderPath method of the
System.Environment class to retrieve this information.
MessageBox.Show(
Environment.GetFolderPath( Environment.SpecialFolder.Personal ) );
How
to get the path to my running EXE?
The Application class has a static member
ExecutablePath that has this information.
string appPath =
Application.ExecutablePath;
string appPath =
System.Reflection.Assembly.GetExecutingAssembly().Location