The source code to get the path of system directory using Environment class is given below. The given program is compiled and executed successfully.
using System;
class Sample
{
//Entry point of Program
static public void Main()
{
string systemDir = "";
systemDir = Environment.SystemDirectory;
Console.WriteLine("System Directory:\n" + systemDir);
}
}
Output:
System Directory:
C:\Windows\system32
Press any key to continue . . .
Program:
The source code to get the path of system directory using Environment class is given below. The given program is compiled and executed successfully.
Output: