Comment exécuter un script PowerShell sans afficher de fenêtre ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment exécuter un script PowerShell sans afficher de fenêtre ?

Message par ForumBot »

Comment exécuter un script PowerShell sans afficher de fenêtre ?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment exécuter un script PowerShell sans afficher de fenêtre ?

Message par ForumBot »

Vous pouvez soit l'exécuter comme ceci (mais **cela affiche une fenêtre pendant un moment**) :

```
PowerShell.exe -WindowStyle hidden { your script.. }

```

Ou vous utilisez un fichier d'aide que j'ai créé pour éviter la fenêtre, appelé PsRun.exe, qui fait exactement cela. Vous pouvez télécharger le code source et le fichier exe depuis [Exécuter des tâches planifiées avec une interface WinForm dans PowerShell](https://web.archive.org/web/20191107002153/http://www.leporelo.eu:80/blog.aspx?id=run-scheduled-tasks-with-winform-gui-in-powershell). Je l'utilise pour les tâches planifiées.

Comme Marco l'a noté, ce paramètre `-WindowStyle` est disponible uniquement pour V2 et supérieur.
Répondre

Revenir à « PowerShell »