I am trying to execute a file using shell_exec in PHP. However, whenever a .bat file is executed it's ran from cd C:/xampp/htdocs instead of a folder within that such as cd C:/xampp/htdocs/folder. Here's an example.
shell_exec('c:\WINDOWS\system32\cmd.exe /c START c:/xampp/htdocs/TeenHost/mc/folder/start.bat');
So, the start.bat will run, but any files it creates will be created in the web root of C:/xampp/htdocs. I want it in the folder it was executed from.
Any help?
Solved. Used chdir('c:/xampp/htdocs/TeenHost/mc/folder/'); before using shell_exec