C# 获取当前应用程序所在的根路径

来源:互联网 发布:罗马全面战争 for mac 编辑:程序博客网 时间:2024/05/16 13:57

调用命令:

E:\test\WCMData\extractword\WordExtractor.exe -t E:\test\WCMData\protect\P0201308\P020130826\\P020130826754384885013.doc E:\test\WCMData\systemp\ST201308\ST20130827\ST20130827332888176876.xml

 

当前执行命令路径:

C:\Users\Administrator>

 

 Console.WriteLine(System.Environment.CurrentDirectory);
 Console.WriteLine(System.IO.Directory.GetCurrentDirectory());
 Console.WriteLine(System.AppDomain.CurrentDomain.BaseDirectory);
 Console.WriteLine(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase);

 

的输出结果:

E:\TRS\EKPV70_for_mysql\WCMData\extractword\WordExtractor.exe
C:\Users\Administrator
C:\Users\Administrator
E:\TRS\EKPV70_for_mysql\WCMData\extractword\
E:\TRS\EKPV70_for_mysql\WCMData\extractword\

 

完整的调用代码:

C:\Users\Administrator>E:\TRS\EKPV70_for_mysql\WCMData\extractword\WordExtractor
.exe -t E:\TRS\EKPV70_for_mysql\WCMData\protect\P0201308\P020130826\\P0201308267
54384885013.doc E:\TRS\EKPV70_for_mysql\WCMData\systemp\ST201308\ST20130827\ST20
130827332888176876.xml
E:\TRS\EKPV70_for_mysql\WCMData\extractword\WordExtractor.exe
C:\Users\Administrator
C:\Users\Administrator
E:\TRS\EKPV70_for_mysql\WCMData\extractword\
E:\TRS\EKPV70_for_mysql\WCMData\extractword\