打开文件夹并选择该文件 [英] Open Folder and Select the file

查看:135
本文介绍了打开文件夹并选择该文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下code生产未发现异常的文件。

the following code produces a file not found exception.

System.Diagnostics.Process.Start(
    "explorer.exe /select," 
    + listView1.SelectedItems[0].SubItems[1].Text + "\\" 
    + listView1.SelectedItems[0].Text);

我怎么能得到这个命令在C#中执行?

how can I get this command to execute in c#?

推荐答案

使用这方法

Process.Start(String, String)

第一个参数是一个应用程序(explorer.exe的),第二个方法的参数是运行应用程序的参数。

First argument is an application (explorer.exe), second method argument are arguments of the application you run.

例如:

在CMD:

explorer.exe -p

在C#中:

Process.Start("explorer.exe", "-p")

这篇关于打开文件夹并选择该文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆