Home > OS >  How to run a console application in any directory, such as Windows native commands?
How to run a console application in any directory, such as Windows native commands?

Time:07-14

I am not so long in the software developer business, just finding my way.

For a current project I need to start a console application. What this application does is not really important. Currently, I always navigate to the directory where the app (.exe) is located with 'cd ....' in the console, then type the name of the app.exe, followed by the commands and parameters I want to pass.

Now it was my idea, there must be some way that I can type the command and parameters directly into the console without first going into the directory and without naming the app.exe. Like it works with the windows own commands like ipconfig, systeminfo or tasklist.

Is this possible, or is my desired behavior reserved for Windows native commands?

Thank you very much for your help.

CodePudding user response:

Add your directory to the %Path% environment variable.

To do it programmatically, write to the registry and then broadcast WM_SETTINGCHANGE, 0, (LPARAM) "Environment".

  • Related