![]() |
|
#1
|
|||
|
|||
Execute Batch File from within C CodeI am writing a command line C program for the windows 2000/XP environments.
How do I execute/call a batch file from within my c code? Thanks! |
|||
|
#2
|
|||
|
|||
|
Quote:
An easy way is with the system() function. If your batch file is in the same directory as the executable, or is in the %path% of executables for your machine, just use something like this CPP / C++ / C Code:
Where xxx and yyy are arguments to the batch file named batchfilename.bat. If the batch file is somewhere else, then you have to include the directory path. Suppose you put all of your batch files in directory F:\bin. Then you would have something like this: CPP / C++ / C Code:
You don't really need the .bat Anything that you can enter from the command line can be done with the system() call. Here's a program example: CPP / C++ / C Code:
You can try it with this batch file Code:
Regards, Dave |
Recent GIDBlog
Review: Gel laptop cooling pad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 08:44 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 10-Mar-2004 00:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The