How do I run a Fastload script on Unix

How do I run a PowerShell script without showing a window?


Reply:


You can either do it like this (but this will show a window for a while):

Or you can use a helper file I created to avoid the PsRun.exe window which does just that. You can download the source and exe files. Perform scheduled tasks using the WinForm user interface in PowerShell. I use it for scheduled tasks.

Edited: As Marco noted, this window style parameter is only available for V2.







I had the same problem. I found out when on the go task in Task planner who runs that powershell.exe Script, you can click " Run whether user is logged in or not “And that will never show the Powershell window when the task is running.






Here's an approach that doesn't require command line arguments or a separate launcher. It is not completely invisible as a window is temporarily displayed at startup. But then it quickly disappears. Where that's okay, I think this is the easiest approach if you want to start your script by double-clicking it in Explorer or via a shortcut to the Start menu (including the Start submenu, of course). And I like that it's part of the code of the script itself, not something outside.

Paste this at the front of your script:


Here is a one-liner:

While it is possible for a window to flash very briefly, this should rarely happen.





I had this problem while running C #. In Windows 7, the "Interactive Services Detection" service was displayed when a hidden Powershell window was run as the SYSTEM account.

Using the "CreateNoWindow" parameter prevented the ISD service from displaying its warning.


I think the best way to hide the PowerShell console screen when running a background script is with this code (answer "bluecakes").

I'll add this code to the top of all of my PowerShell scripts that I need to run in the background.

If this answer helped you, vote for "Bluecakes" in his answer in this post.



ps1 hidden in the task planner and also in the link


I've created a little tool that routes the call to any console tool you'd like to start windowless down to the original file:

https://github.com/Vittel/RunHiddenConsole

Once compiled, just rename the executable to " w.exe" (add a "w") and place it next to the original executable. You can then call eG Powershellw.exe with the usual parameters and no window will open.

If anyone has any idea how to check if the created process is waiting for input, I am happy to add your solution to you :)





Here is a working solution in Windows 10 that doesn't include any third-party components. It works by wrapping the PowerShell script in VBScript.

Step 1: We need to change some Windows features to allow VBScript to run PowerShell and open .ps1 files with PowerShell by default.

Run -go and enter "regedit". Click OK and then let it run.

- Paste this path "HKEY_CLASSES_ROOT \ Microsoft.PowerShellScript.1 \ Shell" and press Enter.

-Now open the entry on the right and change the value to 0.

-Open PowerShell as administrator and enter "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned", press Enter and confirm the change with "y" and then enter.

Step 2: now we can start wrapping our script.

-Save your Powershell script as a .ps1 file.

- Create a new text document and paste this script into it.

- Now change the file path to the location of your .ps1 script and save the text document.

- Now right click on the file and rename it. Then change the file name extension to .vbs, press Enter and click OK.

DONE! Now when you open the .vbs you shouldn't see a console window while your script is running in the background.

Make sure to vote positively if this worked for you!


Here's a fun demo of controlling the various states of the console, including minimizing and hiding.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.