Jump to content

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>";

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.