Question Deploying console application - how to run exe from any folder?

T.O. Double-Dizzle

New member
Joined
Sep 10, 2010
Messages
3
Programming Experience
5-10
I developed a small console application called foo.exe, and I've created a Windows Installer project in Visual Studio Pro 2010 (trial version for now). The installer then places the foo executable in its target location (Program Files), and I can run the program successfully from its Program Files folder.

My problem is that whenever I try to run the program from anywhere else (i.e. C:\), Windows doesn't recognize it. This seems like a registry issue to me, but I'm clueless as to how to fix it. I looked at Microsoft's deployment/installer documentation, but I couldn't find a solution.

Could someone please post a walkthrough?

Any help would be greatly appreciated.

Thanks.
 
When I navigate to C:\ and type "foo" from a command window, I get the following message:

'foo' is not recognized as an internal or external command, operable program or batch file.

Thanks.
 
Hi Kulrom,

I don't think I explained my problem well enough.
I too can run the app successfully when I copy the exe to the C:\ drive (or wherever I'm trying to run it from).

My issue is that I need to be able to run the program from anywhere without having to copy it. I only want 1 instance of the executable on the user's hard drive. Take Notepad for example. If you open a command window and type "notepad", Notepad.exe opens. This is probably not the best example, since notepad.exe is located in the system32 folder, and I specifically do not want to place any of my programs there. But hopefully it illustrates my point well enough.

My foo program is one of several engineering applications that are interfaces between 3rd party codes. Foo reads a results file from one 3rd party code and creates/modifies the input file for another 3rd party code. Eventually, I plan to wrap foo and similar codes into an overall driver program.


Thanks for your help.
 
If you type 'path' in command prompt you'll see which paths are available when the command interpreter search for executables. System32 folder is just one of them. In Windows you may configure environment variables, and the PATH variable is one of them. This is accessible from Control Panel, advanced System settings, environment variables. It can also be set programmatically using the Environment class. In your case though you should probably be looking for ways to modify it during the setup process, something I can't advice about.
 
Back
Top