Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   A query regarding a BAT file (http://www.go4expert.com/forums/query-regarding-bat-file-t26393/)

vikky1988i 28Jul2011 16:41

A query regarding a BAT file

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. :pleased:
Please help me out... thanks in advance...

xpi0t0s 29Jul2011 15:30

Re: A query regarding a BAT file
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 31Jul2011 17:35

Re: A query regarding a BAT file
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 31Jul2011 23:31

Re: A query regarding a BAT file
Google "man system". man is a Unix command short for "manual".

All times are GMT +5.5. The time now is 10:57.