Created
September 10, 2017 13:26
-
-
Save Youka/46f93ffb0dc98087dc461742b12b9e8e to your computer and use it in GitHub Desktop.
Powershell process hides console in background
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Hide console | |
| Add-Type -Namespace User32 -Name Functions -MemberDefinition @" | |
| [DllImport("user32.dll")] | |
| public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); | |
| "@ | |
| [User32.Functions]::ShowWindowAsync((Get-Process -Id $pid).MainWindowHandle, 0) | |
| # Register form objects from .NET | |
| [void][reflection.assembly]::loadwithpartialname("System.Windows.Forms") | |
| # Create & show simple dialog | |
| (New-Object system.Windows.Forms.Form).showdialog() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment