pieterheijms
Enthusiast
Enthusiast

Run shortcut hidden

Jump to solution

Hi,

Can I run a shortcut in hidden mode? I only see the option "normal window", "minimized" and "Maximized".

We have a few powershell scripts and the script will start an application. I want to run the powershell script in hidden mode and that the powershell script runs / shows the application.

Grtz,

Pieter

1 Solution

Accepted Solutions
ijdemes
Expert
Expert

Did you try the -windowstyle parameter for powershell.exe?

For example:

C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -file c:\temp\test.ps1

Depending on your environment you may also need to add the -executionpolicy parameter for powershell.exe.


\\ Ivan
---
Twitter: @ivandemes
Blog: https://www.ivandemes.com

View solution in original post

7 Replies
ijdemes
Expert
Expert

Are you directly referring to powershell in the shortcut?

Did you try the "start" command? You can open a command prompt and type "start /?" to see the available parameters.


\\ Ivan
---
Twitter: @ivandemes
Blog: https://www.ivandemes.com
0 Kudos
pieterheijms
Enthusiast
Enthusiast

Yes, the shortcut points directly to powershell.

I did not try start, but I can't use it (not sure), because "start" is a command built into the CMD shell. So I have no idea how to use start to run a hidden powershell window.

0 Kudos
ijdemes
Expert
Expert

Did you try the -windowstyle parameter for powershell.exe?

For example:

C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -file c:\temp\test.ps1

Depending on your environment you may also need to add the -executionpolicy parameter for powershell.exe.


\\ Ivan
---
Twitter: @ivandemes
Blog: https://www.ivandemes.com

View solution in original post

DEMdev
VMware Employee
VMware Employee

Hi Pieter,

Can I run a shortcut in hidden mode? I only see the option "normal window", "minimized" and "Maximized".

I'm aware that this does not provide a solution to your real question, but just for completeness: DEM supports the same options as Windows itself.

pastedImage_5.png

We have a few powershell scripts and the script will start an application. I want to run the powershell script in hidden mode and that the powershell script runs / shows the application.

Maybe combining Run: Minimized on the (DEM) shortcut (to limit the visibility of PowerShell's console window flashing by) with Ivan's -WindowStyle Hidden suggestion does the trick?

pieterheijms
Enthusiast
Enthusiast

Hi,

Did you try the -windowstyle parameter for powershell.exe?

Now I tried. I still see 1 sec. a black screen, but I don't see code. When I minize this screen it's acceptable.

Thank you for your answer!

pieterheijms
Enthusiast
Enthusiast

I'm aware that this does not provide a solution to your real question, but just for completeness: DEM supports the same options as Windows itself.

Yes, I understand. But by the product we use at the moment, this is an option Smiley Happy. We are going to use the option which Ivan suggested..

0 Kudos
DEMdev
VMware Employee
VMware Employee

So does that product that should not be named Smiley Happy let you create Windows shortcuts that launch their target hidden? Interesting...