2012-07-24 2 views
0

내가 VB.NETWindows 탐색기를 열고 : 올바른 폴더에 열리지 않습니다

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에서, 프로그램에서 파일을 찾기 위해 노력하고 있어요 : \ 에는/e 후,이 시도

+0

코드가 저에게 효과적이었습니다. 'C : \ test'와'C : \ test \ a.txt'가 실제로 존재합니까? – aphoria

답변

0

당신은 거기에 폴더 경로가 필요하지 않습니다 ... \ 테스트 "나는 파일을 선택하고 싶은 : C는"그러나 내부를 이동하지 않습니다 " 귀하의 매개 변수 :

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