A query regarding a BAT file

vikky1988i's Avatar, Join Date: Apr 2010
Go4Expert Member
Hi,

How can i execute a .BAT file using my C program..

When i try to execute using SYSTEM() , it's giving me "EXTENDED ERROR 183"
is there any special way to execute .BAT files?? let me know soon.
Please help me out... thanks in advance...
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
The system() call only launches executables, and bat files aren't executable. Executable files end ONLY with .exe or .com. The executable for batch files is the command prompt, so you'll need something like system("cmd.exe -z myfile.bat"); - replace -z with whatever flag is needed to make cmd.exe run a batch file then exit.
vikky1988i's Avatar, Join Date: Apr 2010
Go4Expert Member
thanks for ur help......

i got it


Hw can we return any values to this Batch files from any other programs.. eg: from C hw can we retrun

i got a idea that we can store somevalues from any program in a txt file and make the batch file to read it.. but without this is there any way???



Thanks in advance....
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Google "man system". man is a Unix command short for "manual".