显示或隐藏图标和任务栏_Win10和Win11.cmd.txt - 洛阳翼展电脑


显示或隐藏图标和任务栏_Win10和Win11.cmd.txt

2023-10-27 乱云飞

@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit

:begin
rem 从注册表获取当前数值
FOR /F "tokens=2,*" %%A IN ('REG Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3" /V "Settings" ^|findstr "Settings"') DO (
    SET SETTINGS=%%B
)
FOR /F "tokens=2,*" %%A IN ('REG Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V "HideIcons" ^|findstr "HideIcons"') DO (
    SET HIDEICONS=%%B
)
FOR /F "tokens=2,*" %%A IN ('REG Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /V "ShellState" ^|findstr "ShellState"') DO (
    SET SHELLSTATE=%%B
)
FOR /F "tokens=2,*" %%A IN ('REG Query "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /V "FFlags" ^|findstr "FFlags"') DO (
    SET FFLAGS=%%B
)

IF "%HIDEICONS%" == "0x0" (
    rem 隐藏任务栏
    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3" /V Settings /T REG_BINARY /d %SETTINGS:~0,17%3%SETTINGS:~-78% /F

    rem 隐藏桌面图标
    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V HideIcons /T REG_DWORD /D 1 /F
    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /V ShellState /T REG_BINARY /D %SHELLSTATE:~0,10%3%SHELLSTATE:~-61% /F
    REG ADD "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFlags /T REG_DWORD /D %FFLAGS:~0,6%1%FFLAGS:~-3%  /F

    rem 在这行下面添加隐藏任务栏和桌面图标后需要执行的命令,比如启动某软件
    
) ELSE (
    rem 显示任务栏
    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3" /V Settings /T REG_BINARY /d %SETTINGS:~0,17%2%SETTINGS:~-78% /F

    rem 显示桌面图标
    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V HideIcons /T REG_DWORD /D 0 /F
    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /V ShellState /T REG_BINARY /D %SHELLSTATE:~0,10%2%SHELLSTATE:~-61% /F
    REG ADD "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFlags /T REG_DWORD /D %FFLAGS:~0,6%0%FFLAGS:~-3%  /F)

    rem 在这行下面添加显示任务栏和桌面图标后需要执行的命令,比如关闭某软件
    
)

rem 等待1秒
TIMEOUT 1 >NUL

rem 重启资源管理器
TASKKILL /F /IM explorer.exe
START explorer.exe

本文链接:http://80c.cc/ez/713.html
0

发表评论:

VirtualCamera:在录像机中虚拟一个通道显示电脑桌面、视频文件、USB摄像头~
预ICP备10086-001号 © 翼展网/80C.CC 技术支持/洛阳翼展科技
TEL / 13213610060 QQ / 345794501
Powered by emlog