开发者

C# Command line application working path

I have a command line application that resides in the system32 folder so that i can call this application from anywhere with out having to fill in 开发者_StackOverflow中文版the full path to the app. The app takes in one parameter which is a full file path (EX: C:\Test\Test.txt) and works fine when it takes in this parameter (EX: C:\Test>Test.exe C:\Test\test.txt).

I brake the incoming parameter apart into path and file name. I would like to be able to call the application with out filling in the full path to the file (EX: C:\Test>Test.exe test.txt) however i'm not sure how to get the current working path of "C:\Test\" to fill in my path variable when it comes in empty.

I have tried to use the following however it returns the path to the system32 folder and not "C:\Test\":

string _Path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);


Use GetCurrentDirectory()

 Directory.GetCurrentDirectory();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜