Web Hosting Talk







View Full Version : PHP call to exec a .bat file


concept
12-09-2003, 04:04 AM
ok I have a windows 2003 server, running apache. What i want to do is via a php call exec a .bat file called 3868.bat located in c: what is teh php command to do this?

CyberAlien
12-09-2003, 04:35 AM
echo exec('c:\whatever\whatever.bat');

concept
12-09-2003, 12:59 PM
i believe it was tried without hte eco and didnt work, ill try with the echo

concept
12-09-2003, 01:06 PM
Thank you so much CyberAlien, the echo was EXACTLY what i was missing.

CyberAlien
12-09-2003, 05:50 PM
if you want without echo() then try passthru(), but it will output some extras that you might not want.

concept
12-10-2003, 02:07 AM
ok, also on the same server im trying to execute a .reg file that will auto enter a registry edit, but its not executing, is there a different command we should use?

CyberAlien
12-10-2003, 05:29 AM
shell_exec('regedit /S myfile.reg');