打開指定路徑的文件夾,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)
這句話去讀該根目錄然後截取自己想要的目錄位置,此處依自己的情況而設置

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