C 獲取程式執行目錄當前目錄

2021-09-27 23:33:26 字數 419 閱讀 8130

// 獲取程式的基目錄。 

// 獲取模組的完整路徑。

system.diagnostics.process.

getcurrentprocess()

.mainmodule.filename

// 獲取和設定當前目錄(該程序從中啟動的目錄)的完全限定目錄。

system.environment.currentdirectory

// 獲取應用程式的當前工作目錄。

system.io.directory.

getcurrentdirectory()

// 獲取和設定包括該應用程式的目錄的名稱。

// 獲取啟動了應用程式的可執行檔案的路徑。

// 獲取啟動了應用程式的可執行檔案的路徑及檔名。

獲取當前程式執行目錄

1.使用 getcwd std string getmodulepath char path nullptr path char malloc ilength sizeof char path getcwd modulepath,ilength if null path free path if f...

c 獲取當前執行程式所在的目錄

c 獲取專案程式及執行路徑的方 2.c winform用 d system.threading.thread.getdomain basedirectory 獲取當前應用程式所在目錄的路徑,最後包含 e environment.currentdirectory 獲取當前應用程式的路徑,最後不包含 f...

C 獲取當前目錄

答案一答案二 獲取新的 process 元件並將其與當前活動的程序關聯的主模組的完整路徑,包含檔名 程序名 string str system.diagnostics.process.getcurrentprocess mainmodule.filename result x exe exe檔案所在...