|
新建一个批处理文件,内容如下:
@echo off
:QuanXian
::为当前批处理脚本获取管理员权限。
1>nul 2>nul reg query HKU\S-1-5-19
if %errorlevel%==0 goto :Admin
pushd %~DP0 & cd /d "%~dp0"
%1 %2
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
:Admin
::切换当前目录至批处理文件所在位置。
cd /d %~dp0
::开启延迟环境变量扩展。
setlocal EnableDelayedExpansion
:ShuoMing
::清理屏幕。
cls
::设置窗口尺寸【80列15行】。
mode con cols=80 lines=15
::设置背景颜色【0黑色】、文字颜色【7白色】。
color 07
:生成【显示桌面】命令文件(%windir%与%SystemRoot%在此处等效)
echo [Shell] >"%windir%\显示桌面.scf"
echo Command=2 >>"%windir%\显示桌面.scf"
echo IconFile=explorer.exe,3 >>"%windir%\显示桌面.scf"
echo. >>"%windir%\显示桌面.scf"
echo [Taskbar] >>"%windir%\显示桌面.scf"
echo Command=ToggleDesktop >>"%windir%\显示桌面.scf"
:为【显示桌面】创建快捷方式
echo Dim WshShell,Shortcut >%TEMP%\tmp.vbs
echo Dim path,fso >>%TEMP%\tmp.vbs
echo path="%windir%\显示桌面.scf" >>%TEMP%\tmp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject") >>%TEMP%\tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell") >>%TEMP%\tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut("%UserProfile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\显示桌面.lnk") >>%TEMP%\tmp.vbs
echo Shortcut.TargetPath=path >>%TEMP%\tmp.vbs
echo Shortcut.Save >>%TEMP%\tmp.vbs
call %TEMP%\tmp.vbs
del /f /s /q %TEMP%\tmp.vbs
:通过注入注册表键值,将【显示桌面】固定到任务栏
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Favorites" /t REG_BINARY /d "00940100003a001f80c827341f105c1042aa032ee45287d668260001002600efbe12000000ea7e1e67b227d801e0562875b227d8013fa40aeaff29d801140056003100000000005954312311005461736b42617200400009000400efbe5654ec30595433232e000000dd8e000000000100000000000000000000000000000074380a005400610073006b0042006100720000001600020136004903000059545b2320003e663a794c6862972e006c006e006b000000420009000400efbe59545b2359545b232e0000004c9a0000000006000000000000000000000000000000c156c0003e663a794c6862972e006c006e006b0000002000220000001e00efbe02005500730065007200500069006e006e006500640000002000120000002b00efbe3fa40aeaff29d80120006c0000001d00efbe02007b00460033003800420046003400300034002d0031004400340033002d0034003200460032002d0039003300300035002d003600370044004500300042003200380046004300320033007d005c003e663a794c6862972e00650078006500000020000000ff" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "FavoritesResolve" /t REG_BINARY /d "300300004c0000000114020000000000c00000000000004683008000200000003fa40aeaff29d8013fa40aeaff29d8013fa40aeaff29d80149030000000000000100000000000000000000000000000094013a001f80c827341f105c1042aa032ee45287d668260001002600efbe12000000ea7e1e67b227d801e0562875b227d8013fa40aeaff29d801140056003100000000005954312311005461736b42617200400009000400efbe5654ec30595433232e000000dd8e000000000100000000000000000000000000000074380a005400610073006b0042006100720000001600020136004903000059545b2320003e663a794c6862972e006c006e006b000000420009000400efbe59545b2359545b232e0000004c9a0000000006000000000000000000000000000000c156c0003e663a794c6862972e006c006e006b0000002000220000001e00efbe02005500730065007200500069006e006e006500640000002000120000002b00efbe3fa40aeaff29d80120006c0000001d00efbe02007b00460033003800420046003400300034002d0031004400340033002d0034003200460032002d0039003300300035002d003600370044004500300042003200380046004300320033007d005c003e663a794c6862972e00650078006500000020000000a50000001c000000010000001c0000003300000000000000a40000001700000003000000a91a920e1000000053797374656d00433a5c55736572735c41646d696e6973747261746f725c417070446174615c526f616d696e675c4d6963726f736f66745c496e7465726e6574204578706c6f7265725c517569636b204c61756e63685c557365722050696e6e65645c5461736b4261725ccfd4cabed7c0c3e62e6c6e6b000060000000030000a058000000000000006465736b746f702d336a62313663760000000000000000000000000000000000231e98cccb95ec11a98600808e8a8fab00000000000000000000000000000000231e98cccb95ec11a98600808e8a8fab45000000090000a03900000031535053b1166d44ad8d7048a748402ea43d788c1d0000006800000000480000004f5ae3f6a45cd94babe58be29f40522a000000000000000000000000" /f
:提示并重启资源管理器进程使得修改操作生效
cls
echo.
echo.
echo 添加【显示桌面】操作完成,按任意键后将重启资源管理器进程,从而令操作生效。
pause
taskkill /f /im explorer.exe
start explorer.exe
执行后会固定显示桌面图标到任务栏(副作用是原有的固定图标会被清除,所以建议在系统刚安装完毕时使用),Win10经测试是有效的。 |
|