Hide/Show the Windows 7 Taskbar and StartButton

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Code:
@setlocal
@echo off
::
:: Batch file to Hide/Show the Windows 7 Taskbar, and StartButton
::
:: TODO: More error checking
::
iff %# eq 0 then
  echo USAGE: %_BATCHNAME [Hide] [Show]
  quit
endiff
set SW_HIDE=0
set SW_SHOW=1
set hwndTaskBar=%@winapi[user32,FindWindow,"Shell_TrayWnd",""]
set hwndStartButton=%@winapi[user32,FindWindow,"Button","Start"]
iff %1 eq hide then
  set rc=%@winapi[user32,ShowWindow,%hwndTaskBar,%SW_HIDE]
  set rc=%@winapi[user32,ShowWindow,%hwndStartButton,%SW_HIDE]
endiff
iff %1 eq show then
  set rc=%@winapi[user32,ShowWindow,%hwndTaskBar,%SW_SHOW]
  set rc=%@winapi[user32,ShowWindow,%hwndStartButton,%SW_SHOW]
endiff
endlocal
 
Nov 2, 2008
177
0
#2
This batch works with 'taskbar Show', when the windows 7 hides its taskbar on screen-blank. 'Tis useful.
 
Last edited:
Nov 2, 2008
177
0
#3
Many fixes.

Code:
:: TODO: More error checking - fixed.  Either show or hide,
::  or it produces an error message. 
::
setlocal
set SW_HIDE=0
set SW_SHOW=1
set hwndTaskBar=%@winapi[user32,FindWindow,"Shell_TrayWnd",""]
set hwndStartButton=%@winapi[user32,FindWindow,"Button","Start"]
iff d%1 eq dhide then
  set rc=%@winapi[user32,ShowWindow,%hwndTaskBar,%SW_HIDE]
  set rc=%@winapi[user32,ShowWindow,%hwndStartButton,%SW_HIDE]
elseiff d%1 eq dshow then
  set rc=%@winapi[user32,ShowWindow,%hwndTaskBar,%SW_SHOW]
  set rc=%@winapi[user32,ShowWindow,%hwndStartButton,%SW_SHOW]
else
  echo USAGE: %_BATCHNAME [Hide] [Show]
endiff
endlocal