您可以通过简单的批处理或脚本来执行此操作。设置注册表值以根据屏幕的当前分辨率定位任务栏(如果在停靠中它会更高),然后重新启动 explorer.exe。因此,例如在屏幕左侧设置任务栏的批处理将是(假设您在 d:\scripts 文件夹中有 bottom.reg 文件)
reg add d:\scripts\Bottom.reg
@echo off taskkill /f /IM explorer.exe
explorer.exe
bottom.reg 的内容是
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2]
"Settings"=hex:28,00,00,00,ff,ff,ff,ff,02,00,00,00,03,00,00,00,3e,00,00,00,2e,\
00,00,00,00,00,00,00,82,04,00,00,80,07,00,00,b0,04,00,00
对于left.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2]
"Settings"=hex:28,00,00,00,ff,ff,ff,ff,02,00,00,00,00,00,00,00,3e,00,00,00,2e,\
00,00,00,00,00,00,00,00,00,00,00,3e,00,00,00,b0,04,00,00
你会有一些闪烁,但因为当你启动 Windows 时你会这样做,我想这不会是一个问题。我在 Windows 7 上对此进行了测试。
编辑:制作了一个基于屏幕分辨率做同样事情的 vbscript
HKEY_CURRENT_USER = &H80000001
Set WshShell = CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set ObjRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'Get curr. user name
Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")
For Each objItem in colItems
strCurrentUserName = objItem.UserName
Next
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0)
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
bottom = Array(&H28,&H00,&H00,&H00,&Hff,&Hff,&Hff,&Hff,&H02,&H00,&H00,&H00,&H03,&H00,&H00,&H00,&H3e,&H00,&H00,&H00,&H2e,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H82,&H04,&H00,&H00,&H80,&H07,&H00,&H00,&Hb0,&H04,&H00,&H00)
left_ = Array(&H28,&H00,&H00,&H00,&Hff,&Hff,&Hff,&Hff,&H02,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H3e,&H00,&H00,&H00,&H2e,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H3e,&H00,&H00,&H00,&Hb0,&H04,&H00,&H00)
if intHorizontal >= 1920 then
regdata = bottom
else
regdata = left_
end if
ObjRegistry.SetBinaryValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2\", "Settings", regdata
'Restart user shell
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'Explorer.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
wscript.echo colProperties
If strUserDomain & "\" & strNameOfUser = strCurrentUserName then
wscript.echo "restarting"
objProcess.Terminate()
end if
Next