1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<!DOCTYPE html> <html> <head> <title>Ejemplo de abrir aplicaciones desde PHP con Powershell</title> </head> <body> <h1>Abrir Aplicaciones</h1> <form method="post"> <input type="submit" name="open_notepad" value="Abrir Notepad"> <input type="submit" name="open_calc" value="Abrir Calculadora"> <input type="submit" name="open_browser" value="Abrir Navegador"> </form> <?php if (isset($_POST['open_notepad'])) { // Comando Powershell para abrir Notepad $command = 'powershell.exe -ExecutionPolicy Bypass -NoProfile -Command "Start-Process notepad.exe"'; exec($command); echo "<p>Notepad se ha abierto.</p>"; } if (isset($_POST['open_calc'])) { // Comando Powershell para abrir la Calculadora de Windows $command = 'powershell.exe -ExecutionPolicy Bypass -NoProfile -Command "Start-Process calc.exe"'; exec($command); echo "<p>Calculadora se ha abierto.</p>"; } if (isset($_POST['open_browser'])) { // Comando Powershell para abrir el navegador web predeterminado $command = 'powershell.exe -ExecutionPolicy Bypass -NoProfile -Command "Start-Process \"https://www.jesusninoc.com\""'; exec($command); echo "<p>Navegador se ha abierto.</p>"; } ?> </body> </html> |