2009-07-29 66 views

回答

1

Windows资源管理器始终位于Path中,因此只需使用命令行参数调用explorer.exe即可。

同样适用于Internet Explorer,其文件名为iexplore.exe。

0

正如所说的@devio,你并不需要,因为它是在路径来指定,但为了完整起见,你可以使用Environment.ExpandEnvironmentVariables方法:

string path = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\Explorer.exe"); 
0

谢谢!

完整的代码片段兴趣的人,就是:

// Launch MS Explorer with the correct log file selected. 

    //string pathToExplorer = System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%WinDir%"), 
    //            "explorer.exe"); 

    string pathToExplorer = "explorer.exe"; 

    string pathToLogFile = Process.GetCurrentProcess().MainModule.FileName + ".log"; 

    string arguments = String.Format( CultureInfo.InvariantCulture, 
             "/select, \"{0}\"", 
             pathToLogFile); 

    // C:\Windows\explorer.exe /select, "C:\projects\trunk\bin\MyCompany.App.StackTester.exe.log" 

    Process.Start( pathToExplorer, 
        arguments); 
相关问题