打开指定文件夹并选中文件,打开指定文件 .NET实现

private void btnOpenFile_Click(object sender, EventArgs e)
    {
        string _FilePath = this.txtFileFullPath.Text.Trim();
        if (File.Exists(_FilePath))
        {
            //打开指定文件
            System.Diagnostics.Process.Start(_FilePath);
        }
    }
 
    private void button1_Click(object sender, EventArgs e)
    {
        string _FilePath = this.txtFileFullPath.Text.Trim();
        
        //打开指定文件夹选中文件(路径不存在则默认打开并选中我的文档)
        System.Diagnostics.Process.Start("explorer.exe", "/select," + _FilePath);
        
    }
原文地址:https://www.cnblogs.com/jx270/p/2934458.html