Does anyone know how I can automatically hide the task bar in windows 7 via command line or some other method?
To autohide the taskbar from a cmd prompt or in a .cmd or. bat file:
powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=3;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=3;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
The registry key which stores this value also stores a number of other settings. Since we only want to change position 9 ($v[8]
in the cmd) of that registry setting, we need to preserve the other settings.
Normally from cmd, it's enough to use a reg add
command to modify the registry, but we use powershell because it makes it easy to preserve the other settings stored under the same registry key.
Explorer also needs to be restarted to pick up the change. We use Stop-Process
because Windows automatically restarts Explorer when it is stopped.
Note: change $v[8]=3
to $v[8]=2
in the commands above to undo this change (if you want the taskbar to be always visible).