Jump to content

setting the target of a program when using exec or shell_exec


macmee

Recommended Posts

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.