2010-01-30 3 views
16

탐색기 창을 시작하고 WPF로 해당 폴더의 파일을 강조 표시 할 수 있습니까? 난 이미 다음 시도했다 :폴더를 열고 WPF로 특정 파일 강조 표시

Process ExplorerWindowProcess = new Process(); 

ExplorerWindowProcess.StartInfo.FileName = "explorer.exe"; 
ExplorerWindowProcess.StartInfo.Arguments = ConfigFile.File.FullName; 

ExplorerWindowProcess.Start(); 

을 ...하지만 그게 내가 아주 많이하지 않으려는 Windows 탐색기에서 기본 응용 프로그램과 함께 (내 경우 XML 파일) 파일을 엽니 다. Eclipse 용 Aptana 툴을 사용하면 이클립스 프로젝트 브라우저에서 파일을 선택하고 Explorer에서 원하는대로 파일을 표시 할 수 있지만 내 WPF 앱에서이를 구현할 방법이 필요하다는 것을 알고 있습니다.

답변

30

탐색기 명령 줄 인수
http://support.microsoft.com/kb/152457

 
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>] 

/n    Opens a new single-pane window for the default 
        selection. This is usually the root of the drive Windows 
        is installed on. If the window is already open, a 
        duplicate opens. 

/e    Opens Windows Explorer in its default view. 

/root,<object> Opens a window view of the specified object. 

/select,<object> Opens a window view with the specified folder, file or 
        application selected. 

또한과 같이 파일 이름 주위에 따옴표를 넣고 싶을 것이다 :

끝내
startInfo.FileName = "explorer.exe"; 
startInfo.Arguments = "/select,\"" + ConfigFile.File.FullName + "\""; 
+0

은, 대단히 감사합니다 –