0

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 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);
0

1 Answer 1

2

Use GetCurrentDirectory()

 Directory.GetCurrentDirectory();
Sign up to request clarification or add additional context in comments.

1 Comment

It must be one of those days since i actually knew that, but for some reason couldn't think of it until i saw your post and now i feel really stupid. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.