从VB.NET打开Windows资源管理器:未在右侧文件夹中打开

时间:2012-07-24 19:26:53

标签: vb.net process explorer

我试图在VB.NET中找到程序中的文件

Dim exeName As String = "explorer.exe"
Dim params As String = "/e,""c:\test"",/select,""C:\test\a.txt""" 
Dim processInfo As New ProcessStartInfo(exeName, params)
Process.Start(processInfo)

它会打开包含目录“c:\”,但不会进入“c:\ test”,我希望选择该文件...

2 个答案:

答案 0 :(得分:1)

 Dim filePath As String = "C:\test\a.txt" 'Example file
 Process.Start("explorer.exe", "/select," & filePath) 'Starts explorer.exe and selects desired file

答案 1 :(得分:0)

在/ e之后你不需要那里的文件夹路径,试试你的params:

Dim params As String = "/e, /select,""C:\temp\file.txt"""