PoshTip #48 – Start a Process in a Minimized Window using PowerShell

The Start-Process cmdlet starts one or more processes on the local computer. So I can easily open a text file using the following command:

PS > Start-Process notepad.exe C:\Temp\TextFile.txt

It works. But what about the window style? Just imagine you want to open the same text file in a minimized style?

Let’s take a look at information about the Start-Process cmdlet. Use the Get-Help cmdlet to check the available parameters:

As you can notice, there is a WindowStyle parameter that allows you to specify “Minimized” value (Default value is “Normal”). So Let’s try it:

PS > Start-Process notepad.exe C:\Temp\TextFile.txt -WindowStyle Minimized

You may notice that nothing appear except a new NotePad icon on the taskbar.

Note: Use tab expansion to bring up the available options for the “WindowStyle” parameter.

 

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.