How to hide the windows of bat files and ps1 files when running.

Anonymous
2023-11-13T11:02:06.38+00:00

How to hide the windows of bat files and ps1 files when running.

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

1 answer

Sort by: Most helpful
  1. Vahid Ghafarpour 22,060 Reputation points
    2023-11-15T01:43:45.65+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    I'd try using the START utility.

    https://ss64.com/nt/start.html

    It will start a program, command or batch script that opens in a new/separate Command Prompt window. This allows the batch's cmd window to exit in the background.

    START powershell -file "D:\scripts\Powershell\xxx.ps1"

    And take care of common problems with double quote:

    https://stackoverflow.com/questions/154075/using-the-start-command-with-parameters-passed-to-the-started-program

    0 comments No comments

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.