The phrase “batch file” typically means “on Windows.”
The system() call specifically starts an instance of sh on *nixen, and cmd.exe on Windows, passing your string as argument. Hence:
/bin/sh -c your_string
%ComSpec% /C your_string
Obviously, this means that the operating environment invoked by system() is OS-dependent. Some users my (unwisely) substitute another shell for /bin/sh or cmd.exe. If you wish to be extra pedantic, you can specify the shell as nuderobmonkey did — just be path-specific so that you don’t suffer from path injection vulnerabilities:
std::system( "/bin/csh -c my_shell_file.csh" ); // Yes, the (in)famous C-shell
you can also use system to make a c++ program that is like a script or batch program, but more powerful. Batch specifically is fairly limited (compared to unix scripts) so making a 'super-batch' in c++ is worth a look if you do a lot of this kind of work.
I may check that out.
Ive got cygwin hacked into my console, so I can call the unix commands in batch files, allowing me to do most anything I want, but not everyone has or wants all that.
I am not very good at it, to be honest. Most of my batch files do very simple things like launch a program or backup a folder etc.