您可以在一個簡單的批處理或腳本做到這一點。 設置註冊表值以根據屏幕的當前分辨率定位任務欄(如果在對接中它將更高),然後重新啓動explorer.exe。 所以如批量設置在屏幕的左側任務欄會(假設你已經在d的bottom.reg文件:\ scripts文件夾)
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 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
一個肯定的一點是,VBScript的將不能更改任務欄的位置沒有任何第三方工具。我建議使用* AutoIt *腳本(通過鼠標功能)根據當前屏幕大小和方向自動更改任務欄位置以及查詢停靠狀態(通過WMI對象)。 – Jay
傑伊,我證明它可以做到,看到我的答案,不要低估vbscript – peter