Shortcut to toggle small/large taskbar icons?


  1. Posts : 44
    Windows 10
       #1

    Shortcut to toggle small/large taskbar icons?


    Hey guys: I alternate between several monitors each day, with varying resolutions that prompt me to turn Windows' "small taskbar icons" on or off. (Otherwise they're either too tiny to see, or so big they require scrolling.) It's tedious having to open the Taskbar Settings window each time to do this.

    Does anyone know a system command that toggles "small taskbar icons", so I can use it to make shortcuts? I'd really appreciate it.

    Thanks, A.
      My Computer


  2. Posts : 1,211
    Windows 10
       #2

    You can make a REG script. Well two.
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
    "TaskbarSmallIcons"=dword:1
    Just paste that into a text file and save it as a .REG file, dword value of 1 is to enable the small icons and 0 to have large icons so make two REG files which you can name what ever you want so you can recognize which one turn it off and which one turns it on. One obviouse will have dword:1 and the other has dword:0

    You may have to restart Explorer for the effect to visually change i am not sure but this would be easy to do you would have to use bat script instead of REG ones so that you can restart Explorer after the key value is updated.

    - - - Updated - - -

    after just testing yeah Explorer needs to be restarted so here is a bat file version that also restarts Explorer.

    Code:
    @echo off
    
    REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d 1
    
    taskkill /im explorer.exe /f
    start explorer.exe
    exit
    Save as .bat and then you can make a second bat file that has REG_DWORD /d 0 for large icons.
      My Computer


  3. Posts : 42,988
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #3

    Hi, Simply run the exe file (in the attached zip file) which I've created using Autohotkey.

    Each time you run it, the size toggles.

    A Settings window briefly pops up, and then closes.
    Shortcut to toggle small/large taskbar icons? Attached Files
      My Computers


  4. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #4

    Batch files to do the same job


    Batch files can do the job.
    Unlike the .reg file method, you can use a shortcut to run the desired batch file and no further user interaction is required.

    TaskBarIcons-SetSmall.bat
    Code:
    REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d 1 /f
    
    ::Restart explorer - conventional method - closes current File explorer windows
    :: Taken from Restart explorer.exe Process - TenForumsTutorials https://www.tenforums.com/tutorials/5970-restart-explorer-exe-process-windows-10-a.html
    ::Stop explorer.exe
    taskkill /f /im explorer.exe
    Timeout /t 3 >nul
    :: Start explorer.exe
    start explorer.exe


    TaskBarIcons-SetLarge.bat
    Code:
    REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d 0 /f
    
    ::Restart explorer - conventional method - closes current File explorer windows
    :: Taken from Restart explorer.exe Process - TenForumsTutorials https://www.tenforums.com/tutorials/5970-restart-explorer-exe-process-windows-10-a.html
    ::Stop explorer.exe
    taskkill /f /im explorer.exe
    Timeout /t 3 >nul
    :: Start explorer.exe
    start explorer.exe


    Added a few minutes later after I'd seen dalchina's useful idea of toggling the state so there is only a single script to run.
    TaskBarIcons-ToggleLarge-Small.bat
    Code:
    For /F "tokens=3 delims= " %%A in ('Reg Query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarSmallIcons') Do Set CurrentState=%%A
    echo %CurrentState%
    Set CurrentState=%CurrentState:~-1%
    echo %CurrentState%
    
    If  %CurrentState% EQU 1 (GoTo SetLarge) Else (GoTo SetSmall)
    
    :SetLarge
    REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d 0 /f
    GoTo RestartExplorer
    
    :SetSmall
    REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d 1 /f
    
    :RestartExplorer
    ::Restart explorer - conventional method - closes current File explorer windows
    :: Taken from Restart explorer.exe Process - TenForumsTutorials https://www.tenforums.com/tutorials/5970-restart-explorer-exe-process-windows-10-a.html
    ::Stop explorer.exe
    taskkill /f /im explorer.exe
    Timeout /t 3 >nul
    :: Start explorer.exe
    start explorer.exe


    The TimeOut commands are there to counter the possibility of the batch file failing when [unpredictably] it attempts to restart explorer before it has been fully stopped.
    See Bat file to restart explorer.exe sometimes fail - post #1 - TenForums


    There is a method of restarting explorer without losing File explorer windows. It involves running a PowerShell command [which can be done within a batch file].
    See KeithM updated restart explorer ditties [#42] - TenForums


    All the best,
    Denis
    Last edited by Try3; 26 Jan 2023 at 08:52.
      My Computer


  5. Posts : 44
    Windows 10
    Thread Starter
       #5

    Thanks!


    Thanks, guys, for your very generous replies.

    To be honest, I assumed there was just some system statement that could be entered from a command line. (And maybe there is, but M$ never released it?) The solutions you had were quite clever, though.

    I never would've thought of using a macro app like AutoHotKey to actually open the settings window and click the toggle!

    And changing and reloading the registry on-the-fly, that's pretty amazing. I never realized Explorer.exe actually did that... It means you could make and reload any reg changes during a session. That alone seems worthy of its own thread!
      My Computer


  6. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #6

    Ander said:
    And changing and reloading the registry on-the-fly, that's pretty amazing. I never realized Explorer.exe actually did that... It means you could make and reload any reg changes during a session. That alone seems worthy of its own thread!
    It has its own thread, its own tutorial. I put the link in the scripts - Restart explorer.exe Process - TenForumsTutorials

    The KeithM variation is just about as straightforward. I find it very handy to be able to keep open the File explorer folders that I'm working in at the time even if a problem or a Registry change requires a restart.
    RestartExplorerWithFolders.ps1
    Code:
    $Shell = New-Object -ComObject shell.application
    $SavedPaths = ( $Shell.Windows() | select -expand LocationURL )
    Get-Process explorer | Stop-Process
    $SavedPaths | ForEach { explorer $_ }
    When checking my post, I found that Keith had subsequently updated the suggested code - KeithM updated restart explorer ditties [#42] - TenForums I have only tried the revised version once as a test about thirty seconds ago.
    @KeithM


    I call it from a shortcut
    Code:
    powershell.exe C:\Tools\FileExplorerTools\RestartExplorerWithFolders.ps1

    My speech about using a dedicated C:\Tools folder for all my scripts & portable applications is in Set up my Tools folder ditty - TenForums


    Thanks for the rep,
    All the best,
    Denis
    Last edited by Try3; 02 Feb 2023 at 05:18.
      My Computer


  7. Posts : 44
    Windows 10
    Thread Starter
       #7

    How cool is that? And when I think about the countless times I've logged out and back in on Windows to implement such changes—really, we're talking decades... Clearly it's very useful to hang out here. 😊
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:55.
Find Us




Windows 10 Forums