473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

.NET Problem finding path to command line executable

I'm trying to execute a command line from my C++ .NET code/WinXP. The program (call it myprog.exe) is located in a directory (C:\mypath) which is included in the system 'path' environment variable. From a DOS window, I can do the following: "C:\any_other_path>myprog option1 option2...." with no problem. From my code, I've tried using the old 'system()' C-style call (only works if I specify it as "system("c:\mypath\myprog options..."); then I tried using the .NET versions, like so:
Process* compile = new Process();
compile->StartInfo->FileName = "myprog";
compile->StartInfo->Arguments = "options....";
compile->Start();
compile->WaitForExit();

but this failed to find 'myprog' even with it in the system Path....

Then tried running it using "cmd.exe" as the StartInfo->FileName = "cmd.exe" and "myprog options..." as the Arguments. For some reason, no matter what I've tried it fails if not specifed as "C:\mypath\myprog". I expect it would work if I dumped the .exe into c:\system\windows32.
Mar 30 '07 #1
0 1116

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ever Olano | last post by:
Hi. In the docs, it says the command-line executable (that allows you to run PHP scripts on your console as opposed to inside the web server) was introduced in 4.3.0. But I was told by someone...
4
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of...
3
by: Steven Bethard | last post by:
This has probably been answered before, but my Google skills have failed me so far... Is there an os independent way of checking to see if a particular executable is on the path? Basically what...
15
by: Twan Kennis | last post by:
Hi, I have a DB2 database on the IBM iSeries platform, on which I created several Stored Procedures with the SQLCODE as a return-parameter. These Stored Procedures are called from a Windows...
6
by: PAPutzback | last post by:
The process and execute methods want a path to the executable otherwise they kick out a file not found. So how can I execute the following. It works fine from a command window. echo password|...
6
by: comp.lang.php | last post by:
I am not able to find where the PHP executable is located on a shared hosting platform used for one of the sites here at work, and Tech Support appears to either not know or not want us to know...
34
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH...
51
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under...
12
by: =?ISO-8859-1?Q?Thomas_B=F8rlum?= | last post by:
Hey all, I'm writing a c++ program that needs to read a file. I'm trying to read a file that is in the same directory as the executable. Everything works fine if I execute the program while in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.