简体   繁体   中英

Open Windows Explorer from VB.NET: doesn't open in the right folder

I am trying to locate a file from a program, in 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)

It opens the containing directory "c:\\" but doesn't go inside to "c:\\test", I would like to have the file selected...

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

您不需要在/ e之后的文件夹路径,请针对您的参数尝试以下操作:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM