Last active
September 20, 2017 12:58
-
-
Save General-Gouda/a8af69308e2d0f894bd12e8535399479 to your computer and use it in GitHub Desktop.
Commands to hide or show a PowerShell console window.
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
function Show-PowerShell() { | |
$null = $showWindowAsync::ShowWindowAsync((Get-Process –id $pid).MainWindowHandle, 10) | |
} | |
function Hide-PowerShell() { | |
$null = $showWindowAsync::ShowWindowAsync((Get-Process –id $pid).MainWindowHandle, 2) | |
} | |
$script:showWindowAsync = Add-Type –memberDefinition @” | |
[DllImport("user32.dll")] | |
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); | |
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment