如何使用注册表将任务栏按钮设置为“永不组合”?
答案1
您正在寻找“永不分组任务栏按钮”功能。
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel = 00000002
请参阅 KnifeySpoony 对 Windows 7 任务栏按钮文章的评论HowToGeek了解更多信息。
TaskbarGlomLevel – 更改分组,使窗口不会变成正方形并相互重叠。如果打开的窗口太多,它们仍会分组。如果您不想对窗口进行分组,请将此值更改为 00000002。
答案2
站在 Rob 的肩膀上:
通过 powershell (源码):
#http://superuser.com/questions/135015
$taskbarButtonsRegKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
if (((Get-ItemProperty -path $taskbarButtonsRegKey ).TaskbarGlomLevel ) -Ne 2)
{
Set-ItemProperty -Path $taskbarButtonsRegKey -Name "TaskbarGlomLevel" -Value 00000002
}
通过 chocolatey (包裹):
choco install taskbar-never-combine
答案3
这个问题比较老了,但我有几点看法在 VBScript 中以编程方式更改注册表中的设置,然后刷新任务栏无需重新启动或终止 explorer.exe 即可考虑更改。
解决方案 1:需要安装 Excel 才能通过 VBA 调用 Win32 API 来刷新任务栏。这是一个有点繁重的解决方案,因为它需要在后台加载整个应用程序。
Dim WshShell, nKey
Set WshShell = WScript.CreateObject("WScript.Shell")
nKey= WshShell.RegRead("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel")
If nKey = 0 Then
WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel", 2, "REG_DWORD"
ElseIf nKey = 2 Then
WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel", 0, "REG_DWORD"
End If
'Private Const WM_WININICHANGE = &H1A&
'Private Const WM_SETTINGCHANGE = WM_WININICHANGE
'~~> DOES NOT WORK
'litterals seem required even if documentation should allow defining a constant with another constant
'https://www.vbsedit.com/html/61ad308e-6c17-4cd5-a9a6-8a47dc628ba1.asp
'https://stackoverflow.com/questions/15513606/understanding-const-expression-in-vbscript
'Script56.chm
Private Const WM_SETTINGCHANGE = &H1A&
Private Const HWND_BROADCAST = &HFFFF&
'http://www.cpearson.com/excel/call.htm
Dim excel
Set excel = CreateObject("Excel.Application")
Dim strMacro
strMacro = "CALL(""user32"",""SendMessageA"",""JJJJC""," & HWND_BROADCAST & "," & WM_SETTINGCHANGE & "," & 0 & ",""TraySettings"")"
excel.ExecuteExcel4Macro(strMacro)
解决方案 2:更复杂,但通常更快,使用 PowerShell 运行内联脚本进行调用。
Dim WshShell, nKey
Set WshShell = WScript.CreateObject("WScript.Shell")
nKey= WshShell.RegRead("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel")
If nKey = 0 Then
WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel", 2, "REG_DWORD"
ElseIf nKey = 2 Then
WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomLevel", 0, "REG_DWORD"
End If
command = "powershell.exe -nologo -command ""add-type -name user32 -namespace '' -memberDefinition '[DllImport(\""user32.dll\"", CharSet=CharSet.Auto)] public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, uint fuFlags, uint uTimeout, out UIntPtr lpdwResult);'; $HWND_BROADCAST = [intptr]0xffff; $WM_SETTINGCHANGE = 0x1a; $result = [uintptr]::zero; [user32]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [uintptr]::Zero, \""TraySettings\"", 2, 5000, [ref]$result); """
Set objShell = CreateObject("Wscript.shell")
objShell.run command,0