c++ : Use of System() to execute .exe with parameters


 
Thread Tools Search this Thread
Top Forums Programming c++ : Use of System() to execute .exe with parameters
# 1  
Old 12-02-2008
c++ : Use of System() to execute .exe with parameters

Hello,

I 've trie to execute a a program with parameters unsuccessfully and i take the above message :

"The system cannot find the path specified."

I used a variaton of the above command :
system("\"C:\\xxx\\xxx\\xxx.exe -xxx -xxx xxx.xxx xxx.xxx xxx.xxx\"");

Thanks in advance
# 2  
Old 12-02-2008
Can I assume the X's are actual values in your code?

One problem is that you are using a UNIX library call on a DOS platform. If you are using the mk or cygwin toolkits, this might actually work. Otherwise, check your compiler's documentation about the system() call.

One problem is that you have included double-quotes inside the system call. This probably won't work. It might work if you start the double-quotes AFTER the first space. So:
Code:
system("\"C:\\xxx\\xxx\\xxx.exe -xxx -xxx xxx.xxx xxx.xxx xxx.xxx\"");

My guess is, however, no quotes are needed here at all.
# 3  
Old 12-02-2008
I am usind Dev C++, the below it doesnt work too

system("C:\\xxx\\xxx\\xxx.exe -xxx -xxx xxx.xxx xxx.xxx xxx.xxx");
# 4  
Old 12-02-2008
Quote:
Originally Posted by otheus
Can I assume the X's are actual values in your code?

One problem is that you are using a UNIX library call on a DOS platform. If you are using the mk or cygwin toolkits, this might actually work. Otherwise, check your compiler's documentation about the system() call.

One problem is that you have included double-quotes inside the system call. This probably won't work. It might work if you start the double-quotes AFTER the first space. So:
Code:
system("\"C:\\xxx\\xxx\\xxx.exe -xxx -xxx xxx.xxx xxx.xxx xxx.xxx\"");

My guess is, however, no quotes are needed here at all.
I think that the quotes are necessary. Your idea doesnt work.
I use Dev c++
# 5  
Old 12-02-2008
Is it the same error?

I would post a more descriptive path to the executable, say what you would key in the cmd window.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

2. UNIX for Dummies Questions & Answers

Not able to execute an exe file from my location

Hello all, Am facing a peculiar problem, I have copied a utility exe from a bin folder into my local temp folder. I am trying to execute that exe, but it throws out an error saying "No such file or directory". I have given 755 & 777 permissions to it and I tried, but it still throws out that... (6 Replies)
Discussion started by: abhisheksunkari
6 Replies

3. Shell Programming and Scripting

how to execute an exe at startup using rc.local

I want to execute a qt exe program at startup. That is after automatic login instead of loading Desktop and seeing it, the program quickly pop up to the screen. For this, I think we should add the script to rcx.local rather than rc.local I guess though.. I tried adding a script to /etc/rc.local... (0 Replies)
Discussion started by: dr_mabuse
0 Replies

4. Solaris

How to get system parameters / information on Sun Solaris 5.10

Hello to everyone, i am new to Sun Solaris. i have Solaris 5.10 installed on the X86 platform. i am writing a script which gathers some system information. but i can not find some of the parameter from the system can any one please suggest to way to find these params. shell command will be... (1 Reply)
Discussion started by: nikhil.sigpro
1 Replies

5. AIX

System Parameters

Hi, Does anyone know what the System Parameter 'SHMSZ' is and how do I find it? I'm looking for the shared memory size of this particular parameter. Thanks. ---------- Post updated at 11:35 AM ---------- Previous update was at 11:31 AM ---------- Does SHMSZ mean 'Shared Memory SiZe? (2 Replies)
Discussion started by: bbbngowc
2 Replies

6. Shell Programming and Scripting

Execute shell script in different system

Hi, I have a shell script in systemA and another shell script in systemB. when I execute the script in systemA, it should call the another script in systemB. Please tell me the way to do this. Thanks, Raja. (3 Replies)
Discussion started by: smr_rashmy
3 Replies

7. Shell Programming and Scripting

How can I do a rexec to execute un C exe ?

Hello, I would like to do a rexec to execute a C exe (prog.e) : rexec -l user -p password host prog.e When I execute this command, I have this error : prog.e : can not find lib.o But, When I execute prog.e directly in the remote machine : well done ! No error output. Thks for your... (4 Replies)
Discussion started by: Lika
4 Replies

8. UNIX for Advanced & Expert Users

How to Find AIX system parameters

System Parameters: maximum number of processes = 2048 Network parameters: ipqmaxlen - 512 rfc1323 - 1 sb_max - 1310720 (2*655360) tcp_recvspace - 65536 tcp_sendspace - 65536 Udp_recvspace - 655360 Udp_sendspace 65536 (1 Reply)
Discussion started by: R00tSc0rpi0n
1 Replies

9. AIX

Execute a command at the system restart

Hi Folks, I have an AIX server and I would like the server to run the command saprouter -r at every system restarts. It needs to be run by a specific user. How would I do that? Thanks!!! (1 Reply)
Discussion started by: brookingsd
1 Replies

10. Programming

how To edit exe to insert a serial no wich can be usd by runing exe

At time of installation I have to open the resource. and i have to insert a string serial number in the exe. please provide me code to edit the exe (in solaris) to insert a serial number which can be used by exe at run time. (6 Replies)
Discussion started by: ssahu
6 Replies
Login or Register to Ask a Question