Comment exécuter un script PowerShell depuis un fichier batch

Comment exécuter un script PowerShell depuis un fichier batch

Vous avez besoin du paramètre -ExecutionPolicy :

Powershell.exe -executionpolicy remotesigned -File  C:\Users\SE\Desktop\ps.ps1

Sinon, PowerShell considère les arguments comme une ligne à exécuter et bien que Set-ExecutionPolicy soit un cmdlet, il n’a pas de paramètre -File.