Q:

Execute file in another directory

Consider the following:
I have a c++ program in C:\Documents\myProgram.exe
With this code in it:
    system("start C:\\somefolder\\start.bat");
That will start the target file (start.bat) in C:\Documents\ instead of `C:\somefolder\'.
My question is, how do I execute the file in it's own directory instead of myProgram's directory?
In theory this is what I want to accomplish using c++:
    cd C:\somefolder\,
    start start.bat

A:

If you're on windows anyway, use ShellExecute, you can set more things and launch even documents, links etc.

A:

To do this you can do one of two things (that I found).
A) You can use chdir() in unistd.h; see http://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html
or
B) You can  use something called the File System Interface, from the GNU library, for more advanced stuff; see http://www.gnu.org/software/libc/manual/html_node/File-System-Interface.html#File-System-Interface.
Anyway, best of luck, I hope you find something that will work!

