system.diagnostics
.process
.getcurrentprocess()
.mainmodule
.filename
;//獲取新的 process 元件並將其與當前活動的程序關聯的主模組的完整路徑,包含檔名(程序名)。
//返回 e:\c#學習\獲取當前路徑\獲取當前路徑\bin\debug\獲取當前路徑.exe
system..
currentdomain
.setupinformation.;
//獲取和設定包含該應用程式的目錄的名稱。
//返回 e:\c#學習\獲取當前路徑\獲取當前路徑\bin\debug\
system
.windows
.forms..
startuppath
;//獲取啟動了應用程式的可執行檔案的路徑,不包括可執行檔案的名稱。
//返回 e:\c#學習\獲取當前路徑\獲取當前路徑\bin\debug
system
.windows
.forms..
executablepath
;//獲取啟動了應用程式的可執行檔案的路徑,包括可執行檔案的名稱。
//返回 e:\c#學習\獲取當前路徑\獲取當前路徑\bin\debug\獲取當前路徑.exe
system.io
.directory
.getcurrentdirectory()
;//獲取應用程式的當前工作目錄(不可靠)。
//返回 e:\c#學習\獲取當前路徑\獲取當前路徑\bin\debug
this
.gettype()
.assembly
.location
;//獲取當前程序的完整路徑,包含檔名(程序名)。
//遺憾的靜態方法無法使用
//返回 e:\c#學習\獲取當前路徑\獲取當前路徑\bin\debug\獲取當前路徑.exe
stringpath =""
;
if(system.environment.currentdirectory
==//
windows應用程式則相等
Winform獲取應用程式的當前路徑方法集合
winform獲取應用程式的當前路徑的方法集合,具體如下,值得收藏 3 獲取當前程序的完整路徑,包含檔名 程序名 4 string str this.gettype assembly.location 5 result x exe exe檔案所在的目錄 exe檔名 6 7 獲取新的process 元...
Winform獲取應用程式的當前路徑的方法集合
winform獲取應用程式的當前路徑的方法集合,具體如下,值得收藏 獲取當前程序的完整路徑,包含檔名 程序名 string str this.gettype assembly.location result x exe exe檔案所在的目錄 exe檔名 獲取新的process 元件並將其與當前活動的...
獲取程式當前路徑
expandfilename 返回檔案的全路徑 含驅動器 路徑 extractfileext 從檔名中抽取副檔名 extractfilename 從檔名中抽取不含路徑的檔名 extractfilepath 從檔名中抽取路徑名 extractfiledir 從檔名中抽取目錄名 extractfiled...