[C #] [VB.NET] querying the operating system disk location where

Query disk where the operating system resides


Shop in the blue someone ask how to query the location of the operating system, at the age of VB6, you can refer to this website we have a very detailed explanation

http://sunh.hosp.ncku.edu.tw/~cww/html/sysprosystem.html

In .NET, the position may be obtained through the system folder Environment class

Interested can refer to

http://msdn.microsoft.com/en-us/library/system.environment.aspx

VB.NET program

        Dim Str = System.Environment.GetEnvironmentVariable("SystemRoot")
        Dim dir = Microsoft.VisualBasic.Left(Str, 2)
        MessageBox.Show("操作系统在" + dir)

C # program

                string str = System.Environment.GetEnvironmentVariable("SystemRoot");
                string dir = str.Substring(0, 2);
                MessageBox.Show("操作系统在" + dir);

 reference

http://www.blueshop.com.tw/board/show.asp?subcde=BRD20090217182608I60&fumcde=

Original: Large column  [C #] [VB.NET] querying the operating system disk location where


Guess you like

Origin www.cnblogs.com/chinatrump/p/11518131.html