打开指定路径的文件夹,exe文件,config文件

dataSynFile = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\") -3)+<span style="background-color: rgb(0, 0, 0);">"数据同步解决方案</span>\\xml";
            System.Diagnostics.Process.Start("explorer.exe", dataSynFile);
</pre><pre name="code" class="html">
dataSynFile = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\") - 3) + "<span style="background-color: rgb(0, 0, 0);">数据同步解决方案\\数据同步解决方案</span>.exe.config";
            System.Diagnostics.Process.Start("explorer.exe", dataSynFile);
</pre><pre name="code" class="html">
dataSynFile = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\") - 3) + "<span style="background-color: rgb(0, 0, 0);">数据同步解决方案\\数据同步解决方案</span>.exe";
            System.Diagnostics.Process.Start("explorer.exe", dataSynFile);

用该方法均可以打开

Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\") -3)
这句话去读该根目录然后截取自己想要的目录位置,此处依自己的情况而设置

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章