简体   繁体   English

从VB.NET打开Windows资源管理器:在正确的文件夹中未打开

[英]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 我正在尝试从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... 它会打开包含目录“ c:\\”,但不会进入“ c:\\ test”内部,我希望选择文件...

 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""" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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