//獲取模組的完整路徑。
string path1 =system.diagnostics.process.getcurrentprocess().mainmodule.filename;
//獲取和設定當前目錄(該程序從中啟動的目錄)的完全限定目錄
string path2 =system.environment.currentdirectory;
//獲取應用程式的當前工作目錄
string path3 =system.io.directory.getcurrentdirectory();
//獲取程式的基目錄
//獲取和設定包括該應用程式的目錄的名稱
//獲取啟動了應用程式的可執行檔案的路徑
//獲取啟動了應用程式的可執行檔案的路徑及檔名
stringbuilder str=new
stringbuilder();
"system.diagnostics.process.getcurrentprocess().mainmodule.filename:
" +path1);
"system.environment.currentdirectory:
" +path2);
"system.io.directory.getcurrentdirectory():
" +path3);
"" +path4);
"" +path5);
"" +path6);
"" +path7);
string allpath =str.tostring();
輸出結果
system.diagnostics.process.getcurrentprocess().mainmodule.filename:d:\work\prj\vp-vplatform\xmlandxsd\bin\release\xmlandxsd.vshost.exesystem.environment.currentdirectory:d:\work\prj\vp-vplatform\xmlandxsd\bin\release
system.io.directory.getcurrentdirectory():d:\work\prj\vp-vplatform\xmlandxsd\bin\release
C 獲取當前路徑
c 獲取當前路徑的7種方法 c 獲取當前路徑的方法如下 1.system.diagnostics.process.getcurrentprocess mainmodule.filename 獲取模組的完整路徑。2.system.environment.currentdirectory 獲取和設定當前...
C 獲取當前路徑的方法!
獲取新的 process 元件並將其與當前活動的程序關聯的主模組的完整路徑,包含檔名 程序名 string str system.diagnostics.process.getcurrentprocess mainmodule.filename result x exe exe檔案所在的目錄 exe...
C 獲取當前路徑的方法
c 獲取當前路徑的方法如下 1.system.diagnostics.process.getcurrentprocess mainmodule.filename 獲取模組的完整路徑。2.system.environment.currentdirectory 獲取和設定當前目錄 該程序從中啟動的目錄 ...