Would it be possible to open a cmd window via php via web?

Asked

Viewed 200 times

0

I am using the following code below:

$wShell = new COM("WScript.Shell"); 
$exec = $wShell->Run("notepad.exe", 7, false); 
 exec("C:\inetpub\wwwroot\boxlabel\box_bat.bat") or die ("");

I’d like to execute it without being in background opening the window would literally have to do that?

  • Like this: https://ping.eu/ping/ ?

  • that any command

  • 1

    If your intention is to run this on the client machine, via JS or PHP is impossible, for security reasons. Either you develop a module to run on the client machine or run in the background on your server.

  • If you want something running on the machine and in the browser you will have to create a module to run on the machine.

  • I don’t know in windows, but the same example in a *Nix would be: shell_exec('arquivoaserexecutado &') The & causes the process to run in the background, so php will not be stuck waiting for more return as the return was the process ID.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.