Jump to content

Launch application on Windows Server


Cod3r

Recommended Posts

Hello, this is my first post here. Hope you'll be able to help me and vice-versa, seems like a nice community from what I read so far.

 

I am currently facing an issue, hopefully someone will know what I'm doing wrong. I have developed a system in PHP that sends command line arguments to a Windows application on the server. I have first worked on my local installation, and it worked well using PsExec:

 

exec("psexec -d C:\folder\application.exe arg1 arg2 arg3"); 

 

So I thought this would also work on my Windows server. Well, it doesn't. So I search why I wouldn't work. I have allowed the Apache service to interact with the desktop. I have also tried this:

 

exec(" C:\pstools\psexec.exe -d C:\folder\application.exe arg1 arg2 arg3"); 

 

It's kinda hard because I don't get any output whatsoever from exec, I really don't know why it's not launching the application. Also, I am a total Windows noob, it's my first Windows server. This could well be linked :)

 

Thank you for your help.

 

Regards.

Link to comment
https://forums.phpfreaks.com/topic/240569-launch-application-on-windows-server/
Share on other sites

try this :

exec("C:\\pstools\\psexec.exe -d C:\\folder\\application.exe arg1 arg2 arg3");  // Note the double \ usage 

 

other option:

$thecmd = `C:\\pstools\\psexec.exe -d C:\\folder\\application.exe arg1 arg2 arg3`;  // Note the backticks usage (shell_exec equivalent)
echo "<pre>$thecmd</pre>";

 

 

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.