Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

system() call within C++ program

Status
Not open for further replies.

BKURUVALLI

Programmer
Dec 26, 2003
7
US
Hi,

I am using VC++ 6.0
I am using the system method to run a wsh script.

system("wscript run.js");

the run.js should open iexplorer and do stuff.

It opens a command prompt and waits. The script gets executed once I close the command prompt.
I tired to run the hello.js directly

system("run.js");

but it still opens the command prompt and waits.
This behaviour is not consistent with all desktops I run it on.

How can I get the script to run without the command prompt opening consistently.

Thx,
Bharath

 
use CreateProcess("", "wscript yourscript.js" .....

Ion Filipski
1c.bmp
 
Is better as Ion said but you can put in a .bat file like here:
// mybatch.bat file
wscript run.js

and call system:
system("C:\\temp\\1.bat");

-obislavu-
 
>-obislavu-
Take a look at:
>but it still opens the command prompt and waits.
calling of system("some_xxx.bat") also will open the command prompt.

Ion Filipski
1c.bmp
 
The createprocess works fine. Eventhough it opens the command prompt , it does not wait on anything. The script runs and the command prompt window closes by itself.

I was wondering if I need to do something after the createprocess call. close handle etc...

Bharath.
 
you can do CreateProcess("", "yourscript.js"

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top