2011-03-02 18 views

回答

4

你可以使用Path.GetFileNameWithoutExtension獲得的文件名,而不.exe這樣的:

String exe_name =  
    Path.GetFileNameWithoutExtension(
     Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName); 
+0

我認爲這會給出原來的名稱,而不是重命名。 – 2011-03-02 12:32:17

-1

你可以嘗試這樣的事情。

string path = Process.GetCurrentProcess().StartInfo.FileName; 
string name = Path.GetFileNameWithoutExtension(path); 
相關問題