Process Start and application on path

J

JahMic

I exec'ing an application on my path from my console application. I
am getting the "The system cannot find the file specified" exception.
When I overtly add the path it works, This application is often
installed in different locations, so I would rather not hard code in a
path.

Any suggestions to resolve this?

Thanks, J
 
J

JahMic

I exec'ing an application on my path from my console application.  I
am getting the "The system cannot find the file specified" exception.
When I overtly add the path it works,  This application is often
installed in different locations, so I would rather not hard code in a
path.

Any suggestions to resolve this?

Thanks, J

To answer myself, the issue seems to be that of a quoted path, which
is mentioned in docs:

"If you have a path variable declared in your system using quotes, you
must fully qualify that path when starting any process found in that
location. Otherwise, the system will not find the path. For example,
if c:\mypath is not in your path, and you add it using quotation
marks: path = %path%;"c:\mypath", you must fully qualify any process
in c:\mypath when starting it."

I seem to recall other issues with non-quoted paths with spaces in
them, but non-quoted paths are good enough for now.
 
G

Gregory A. Beamer

I exec'ing an application on my path from my console application. I
am getting the "The system cannot find the file specified" exception.
When I overtly add the path it works, This application is often
installed in different locations, so I would rather not hard code in a
path.

Any suggestions to resolve this?

Use the Application object to find the startup path and then you can fire
any process in that directory by adding it. I hope this is what you are
aiming for.

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

My vacation and childhood cancer awareness site:
http://www.crazycancertour.com

*******************************************
| Think outside the box! |
*******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top