| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- # PowerShell script to hide Windows taskbar
- # This script uses Windows API to hide the taskbar
- # Run with: powershell -ExecutionPolicy Bypass -File hide-taskbar.ps1
- try {
- Add-Type @"
- using System;
- using System.Runtime.InteropServices;
- public class Taskbar {
- [DllImport("user32.dll")]
- public static extern int FindWindow(string className, string windowName);
-
- [DllImport("user32.dll")]
- public static extern int ShowWindow(int hwnd, int command);
-
- [DllImport("user32.dll")]
- public static extern int FindWindowEx(int parentHandle, int childAfter, string className, string windowTitle);
-
- public const int SW_HIDE = 0;
- public const int SW_SHOW = 5;
-
- public static void Hide() {
- // Hide main taskbar
- int hwnd = FindWindow("Shell_TrayWnd", null);
- if (hwnd != 0) {
- ShowWindow(hwnd, SW_HIDE);
- }
-
- // Hide secondary taskbar (if exists, e.g., on multi-monitor setup)
- int secondaryHwnd = FindWindow("Shell_SecondaryTrayWnd", null);
- if (secondaryHwnd != 0) {
- ShowWindow(secondaryHwnd, SW_HIDE);
- }
- }
-
- public static void Show() {
- // Show main taskbar
- int hwnd = FindWindow("Shell_TrayWnd", null);
- if (hwnd != 0) {
- ShowWindow(hwnd, SW_SHOW);
- }
-
- // Show secondary taskbar (if exists)
- int secondaryHwnd = FindWindow("Shell_SecondaryTrayWnd", null);
- if (secondaryHwnd != 0) {
- ShowWindow(secondaryHwnd, SW_SHOW);
- }
- }
- }
- "@
- # Hide taskbar
- [Taskbar]::Hide()
-
- # Exit successfully
- exit 0
- } catch {
- # If error occurs, exit with error code
- exit 1
- }
|