我如何獲取我的.exe路徑,因為如果我復(fù)制.exe可以獲取我的新路徑?
4 回答

月關(guān)寶盒
TA貢獻1772條經(jīng)驗 獲得超5個贊
此外:
AppDomain.CurrentDomain.BaseDirectory
Assembly.GetEntryAssembly().Location

慕桂英546537
TA貢獻1848條經(jīng)驗 獲得超10個贊
在Windows窗體項目中:
對于完整路徑(包括文件名):string exePath = Application.ExecutablePath;
僅對于路徑:string appPath = Application.StartupPath;

慕的地10843
TA貢獻1785條經(jīng)驗 獲得超8個贊
在visualstudio 2008中,您可以使用以下代碼:
var _assembly = System.Reflection.Assembly
.GetExecutingAssembly().GetName().CodeBase;
var _path = System.IO.Path.GetDirectoryName(_assembly) ;
- 4 回答
- 0 關(guān)注
- 275 瀏覽
添加回答
舉報
0/150
提交
取消