Voici que je peux courir dans l'invite de commande sans problème:Exécution d'un script Powershell de PHP
powershell -noexit "& ""C:\wamp\www\mypowersher.ps1”""
Mais je veux ajouter à mon script PHP. C'est possible? J'ai essayé d'utiliser exec
mais cela n'a pas fonctionné.
$psPath ='"C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"';
$psDIR = 'C:\\wamp\\www\\mypowersher.ps1';
$psScript = 'mypowersher.ps1';
$runScript = $psDIR. $psScript;
$runCMD = $psPath." "& ".$runScript." 2>&1"";
exec($runCMD);
Qu'avez-vous mis en "exec"? –
Définir "ne fonctionne pas" – Mike
$ psPath = '"C: \\ WINDOWS \\ system32 \\ WindowsPowerShell \\ v1.0 \\ powershell.exe"'; $ psDIR = 'C: \\ wamp \\ www \\ mypowersher.ps1'; $ psScript = 'mypowersher.ps1'; $ runScript = $ psDIR. $ psScript; $ runCMD = $ psPath. "" & ". $ RunScript." 2> &1""; exec ($ runCMD); – Dante