How to hide the window of PowerShell when the PS1 file is running.

Anonymous
2023-11-15T11:02:50.75+00:00

How to hide the window of PowerShell when the PS1 file is running.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,529 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 46,796 Reputation points
    2023-11-15T20:05:06.4766667+00:00

    You can launch the script like this: PowerShell.exe -WindowStyle hidden -File x:\directory\script.ps1

    There are other ways to do this, too. But you haven't said how the script is be launched.

    For example:

    1. https://www.hanselman.com/blog/running-powershell-scripts-from-the-command-line-in-a-hidden-window
    2. Use Start-Process with -WindowStyle Hidden
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.