Find windows folder programmatically in c#

后端 未结 4 642
甜味超标
甜味超标 2021-02-01 13:52

I am writing a program to kill and restart explorer but I don\'t want to hard code the location because some people install windows in different places (for example I found some

4条回答
  •  囚心锁ツ
    2021-02-01 14:34

    Environment.GetFolderPath( Environment.SpecialFolder.Windows ) will return the path to the Windows folder. Recommend this approach over the environment variable, because using an API that does exactly what we want (.NET 4.0 and above).

提交回复
热议问题