发现Windows在C#编程文件夹 [英] Find windows folder programatically in c#

查看:151
本文介绍了发现Windows在C#编程文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个程序来终止并重新启动资源管理器,但我不想硬编码的位置监守一些人在指出错误的地方安装windows(例如我发现谁曾它安装在d人:\驱动器安装在在C:\驱动器确实存在,但已经安装了什么)

I am writing a program to kill and restart explorer but I don't want to hard code the location becuase some people install windows in diffrent places (for example i found someone who had it installed in the d:\ drive where the C:\ drive did exist but had nothing installed on it)

我试过Environment.SpecialFolder下寻找。但我不认为这下

I tried looking under Environment.SpecialFolder. but I don't see a "windows" option under that

任何人都知道该怎么做的最好办法,这是

anyone know what the best way to do this is.

推荐答案

http://msdn.microsoft.com/ EN-US /库/ 77zkk0b6.aspx

尝试这些:

Environment.GetEnvironmentVariable("SystemRoot")

Environment.GetEnvironmentVariable("windir")

这篇关于发现Windows在C#编程文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆