.net 如何打开选择了特定文件夹的 Windows 资源管理器窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6532222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I open a windows explorer window with a specific folder selected
提问by user774411
I have a winform application and this winform application has created few files. I want to implement "find target" function in my application to show those files. Those files located in a same folder. See the picture:
我有一个 winform 应用程序,这个 winform 应用程序创建了几个文件。我想在我的应用程序中实现“查找目标”功能来显示这些文件。这些文件位于同一文件夹中。看图:


Let's say that I have created few files in "C:\Test\"folder and this folder has this file: "C:\Test\File1.txt". How to create "find target" functionality using VB.NET?
假设我在"C:\Test\"文件夹中创建了几个文件,这个文件夹中有这个文件:"C:\Test\File1.txt". 如何使用 VB.NET 创建“查找目标”功能?
回答by Rhapsody
Use Process.Start()to start the Windows Explorer:
使用Process.Start()来启动Windows资源管理器:
Process.Start("explorer.exe", "/select," & "FILETOSELECT")
With the /select, [file]parameter, you can highlight the file.
使用该/select, [file]参数,您可以突出显示文件。
回答by Ranhiru Jude Cooray
Take a look at this articlewhere it specifies the arguments, explorer.exe takes in
看看这篇文章,它指定了参数,explorer.exe 接受
Then use System.Diagnostics.Process.Start

