S
S
sazhyk2017-12-05 08:47:08
PowerShell
sazhyk, 2017-12-05 08:47:08

Are there ways to completely hide the PowerShell window while executing a task?

A task has been created in the scheduler that starts the execution of a PowerShell script for execution on an event. I use the following launch options to hide the console window

powershell.exe -windowStyle hidden -command ″C:\script.ps1″

However, the window, albeit for a fraction of a second, but appears and immediately disappears. Is there a way to completely stop the appearance of the console window? As, for example, in * nix systems.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
azarij, 2017-12-05
@sazhyk

command = "powershell.exe -nologo -command C:\path\to\your\ps\script.ps1"
set shell = CreateObject("WScript.Shell")
shell.Run command,0
is to put in vbs file, in scheduler jobs to specify the path to vbs.

W
WeltRogg, 2019-04-19
@WeltRogg

It's better to tell me how to set the output of Ps to show since I don't see anything.
There is some powershell code in the script and the robocopy utility - I need to see the process, but it is not there by default. In general, everything starts in the background.
If you open PoSh and run a script in it, then the whole process is displayed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question