C# Finding the Path to the Windows Folder

The "SpecialFolder" enum of the "Environment" class is used to find the path to the "Windows" folder (aka SYSROOT) in the C# programming language.

The result C:\WINDOWS will return normally.

Below is an example of how to use it.


string windowsPath = Environment.GetFolderPath(Environment.SpecialFolder.Windows);



You May Interest

C# Finding the Path to the Windows System32 Folder

C# Example of Sum of Even Numbers from 1 to 100

Splitting a String By Desired Character in C#

C# Non-Restart Check If Application is Open

C# Finding the Sine of an Angle