Skip to content

Instantly share code, notes, and snippets.

@moddingg33k
Created August 7, 2020 06:53
Show Gist options
  • Save moddingg33k/9be43eb3bbc267e83933aa339ac310e0 to your computer and use it in GitHub Desktop.
Save moddingg33k/9be43eb3bbc267e83933aa339ac310e0 to your computer and use it in GitHub Desktop.
Add-Type -Name Window -Namespace Console -MemberDefinition '
[DllImport("Kernel32.dll")]
public static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);
'
function Hide-ConsoleWindow
{
$consolePtr = [Console.Window]::GetConsoleWindow()
[Console.Window]::ShowWindow($consolePtr, 0)
}
Hide-ConsoleWindow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment