Reputation: 35
I want to build make a .Net Console application available globally as a CLI command. I tried creating a small application, then adding the executable to my path variable. I then referenced the executable name in the console and it was not found.
I did find that I could add a custom verb through .net core, however that really isn't what I was looking for.
Any ideas?
Upvotes: 1
Views: 446
Reputation: 527
You can try to add the Directory instead of the .exe.
See here for more information in AmiNadimi post : "Register" an .exe so you can run it from any command line in Windows
Upvotes: 2
Reputation: 38850
You need to add the directory of the application to your PATH variable, not the full path including the filename.
For example:
c:\users\john\documents\MyPrograms\test.exe
would be added to PATH as:
c:\users\john\documents\MyPrograms\
and then could be used simply as "test" from Command Prompt.
Note that you need to log out of Windows and log back in for your changes to take effect.
Upvotes: 2