在c#中以编程方式查找Windows文件夹

编程入门 行业动态 更新时间:2024-10-25 16:19:18
本文介绍了在c#中以编程方式查找Windows文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在编写一个程序来杀死并重新启动资源管理器,但我不想硬编码该位置,因为有些人在不同的地方安装Windows(例如我发现有人在d:\驱动器中安装了C:\驱动器确实存在但没有安装它)

我试过在Environment.SpecialFolder下查找。但是我没有看到

的最佳方式是什么?

解决方案

msdn.microsoft / en-us / library / 77zkk0b6.aspx

尝试这些:

Environment.GetEnvironmentVariable(SystemRoot) Environment.GetEnvironmentVariable(windir)

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 someone who had it installed in the d:\ drive where the C:\ drive did exist but had nothing installed on it)

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

What is the best way to do this?

解决方案

msdn.microsoft/en-us/library/77zkk0b6.aspx

Try these:

Environment.GetEnvironmentVariable("SystemRoot") Environment.GetEnvironmentVariable("windir")

更多推荐

在c#中以编程方式查找Windows文件夹

本文发布于:2023-11-13 01:06:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582988.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中以   文件夹   方式   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!