Hide/Show the Windows 7 Taskbar and StartButton

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
216
1
This batch works with 'taskbar Show', when the windows 7 hides its taskbar on screen-blank. 'Tis useful.
 
Last edited:
Nov 2, 2008
216
1
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
 
Nov 2, 2008
216
1
I've turned it into an au3, The problem occurs often enough for this utility to be useful. It's now a compiled AU3, it does not produce a console as tcmd.exe does. Useful tricks to know.

Code:
#include <WinAPISysWin.au3>
;#include <Array.au3>
Local $doit

$win0 = _WinAPI_FindWindow("Shell_TrayWnd", "")
$win1 = _WinAPI_FindWindow("Button", "Srart")
$hide = 0
$show = 1
select
  case $CmdLine[0]==0
    $doit = "help"
  case StringLower($CmdLine[1])=="hide"
    $doit = $hide
  case StringLower($CmdLine[1])=="show"
    $doit = $show
  case Else
    $doit = "help"
EndSelect
if $doit == "help" then
    exit
  else
    $rc = _WinAPI_ShowWindow($win0, $doit)
    $rc = _WinAPI_ShowWindow($win1, $doit)
endif