macmee Posted October 4, 2008 Share Posted October 4, 2008 Hello! I want to use exec to execute a shoutcast server in c:\shoutcast\sc_serv.exe on my Windows server 2003 IIS server. So I use this code <?php exec("c:\shoutcast\sc_serv.exe"); ?> It does execute the program, however, it's making the target of the program c:\windows\system32. Seeing as the configuration file for the sc_serv.exe is in c:\shoutcast\sc_serv.exe, it cannot find the configuration file. I need to somehow tell PHP that I want it to launch sc_serv.exe but with a target of d:\shoutcast .. So I tried this: <?php shell_exec("cd c:\shoutcast"); shell_exec("sc_serv.exe"); ?> But it executed it both commands as if it opened CMD, ran the first command, closed CMD, opened a NEW CMD and ran the last command. It didn't work. If anyone could help me, I would REALLY appreciate it! Link to comment https://forums.phpfreaks.com/topic/127052-setting-the-target-of-a-program-when-using-exec-or-shell_exec/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.