This directory of IGLibScripts contains some useful Windows Utility scripts.
Contents:
-
Documentation - Windows Powerhell Utilities and Template Engine (direct link to external document)
- Introduction - Windows PowerShell Utilities and Template Engine - summary of the scripts available in this directory and basic concepts (typical parameters, etc.)
- Script Reference - complete documentation for scripts in this directory
- ShowFullContextMenus.ps1 - switches to full Explorer's context menu on Windows 11 (or reverts back to reduced menus)
- RemoveTaskbar.ps1 - removes the taskbar (not available on newer Windows)
- HideTaskbar.ps1 - switches on auto-hiding the taskbar (does not work on newer Windows)
- SetDesktopIconSize.ps1 - sets the desktop icon size (to small icons by default, any size via parameters)
- SetTaskbarIconSize.ps1 - sets the size of taskbar icons (not available on newer versions of Windows)
- IconSizeUtility.ps1 - a simple user interface to change the size of desktop and taskbar icons
- AddContextMenuItem.ps1 - adds a custom item to Explorer's context menu, or removes it (e.g., to open a file or directory in a specific program, such as text editor, development environment, any other program, or run a script on it)
- AddCodeToExplorerMenu.ps1 - a wrapper script for
AddContextMenuItem.ps1, which adds Visual Studio Code to Explrer's context menu; serves as example of how to simply utilize theAddContextMenuItem.ps1 - AddCode_Verify.ps1 - auxiliary script that verifies whether the Visual Studio Code has been added to Explorer's menu
- AddCodeToExplorerMenu.ps1 - a wrapper script for
- Other Scripts
- RestartExplorer.ps1 - restarts Windows Explorer; this may be necessary when using the above scripts that modify the behavior of Windows' user interface; however, scripts themselves already have the switch that causes Explorer's restart
- IsAdmin.ps1 - auxiliary - just writes out information on whether the PowerShell is running with elevated privilege (Administrator mode)
- RunAsAdmin.ps1 - auxiliary script - just demonstrate how to implement running a certain PowerShell script in Administrator mode
- Template Engine (ExpandTemplate.ps1) - a fully fledged template
- Appendix - Command Cheatsheet
- Final Notes
-
Miscellaneous Remarks - various helpful remarks for users and developers
- Remarks on RemoveTaskbar.ps1
- Remarks on AddContextMenuItem.ps1 - some tips for using it
-
Notes for Developers - contains dev. notes on possible further feature, behavior, Windows development, etc.
- Notes - Hiding the Taskbar - what is known about using Windows Registry and newer development in Windows that affect hiding the taskbar
- To Do - things that might be done in the future
- Possible Scripting Extensions of ExpandTemplate (the Scripting Engine)
- In Examples for each script, add a comment before each code snippet that tells what the example does (what is the effect). For example:
# Hides the taskbar; -RestartExplorer restarts the Windows Explorer, such that settings take effect.
.\HideTaskbar.ps1 -RestartExplorer
# Attempts to apply the registry changes that hide the taskbar to all users
.\HideTaskbar.ps1 -AllUsers -RestartExplorer
# Reverts the effect of the script / un-hides the taskbar (only fot the current user)
.\HideTaskbar.ps1 -Revert -RestartExplorerDocumentation is currently in this external document.
In the newer versions of Windows 11 (24H2 or higher), control over removing the taskbar via registry has changed or this possibility was removed (as well as the ability to change icon size in taskbar). The basis for the script is given in this article or in this post.
Beside that, there are some differences between RemoveTaskbar.ps1 and HideTaskbar.ps1 when iterating over user profile (SIDs - security identifiers).
The script AddCodeToExplorerMenu.ps1 uses AddContextMenuItem.ps1, and can therefore be consulted to see how the script is used. It can also be used as template for creating sscripts for adding specific items to Windows Explorer's context menu.
A few optional ideas (maybe included in AddCodeToExplorerMenu.ps1 later):
- Show only on Shift-right-click: add the
Extendedflag (so it appears only in the “extended”/Shift menu). - Limit to certain file types: use
-AppliesTo(e.g., only show for.txtor for directories). - Open a new VS Code window: add
-nto the args. - Add a background-only “Open VS Code here”: use
%Vfor the folder path (you already did).
Some quick copy-paste examples using the AddContextMenuItem.ps1, including how to achieve some of the above possibilities:
# 1) Make the entry appear only on Shift-right-click (Files + Directories)
.\AddContextMenuItem.ps1 `
-Title "Open with VS Code" `
-CommandPath "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" `
-Arguments '"%1"' `
-Icon "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" `
-Targets Files,Directories `
-RestartExplorer
# Add the Extended flag
New-ItemProperty -Path "HKCU:\Software\Classes\*\shell\Open_with_VS_Code" -Name Extended -Value "" -Force | Out-Null
New-ItemProperty -Path "HKCU:\Software\Classes\Directory\shell\Open_with_VS_Code" -Name Extended -Value "" -Force | Out-Null# 2) Background-only “Open VS Code here” (no file/folder selection), new window
.\AddContextMenuItem.ps1 `
-Title "Open VS Code here" `
-CommandPath "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" `
-BackgroundArguments '-n "%V"' `
-Icon "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" `
-Targets Background `
-RestartExplorer# 3) Only show for certain types (e.g., .ps1 files)
# Add the menu:
.\AddContextMenuItem.ps1 `
-Title "Open PS1 in VS Code" `
-CommandPath "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" `
-Arguments '"%1"' `
-Icon "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" `
-Targets Files `
-RestartExplorer
# Then scope it with AppliesTo (PowerShell-only files)
New-ItemProperty -Path "HKCU:\Software\Classes\*\shell\Open_PS1_in_VS_Code" -Name "AppliesTo" -Value "System.ItemType:='.ps1'" -Force | Out-NullIf one needs this to also appear in the new Windows 11 condensed menu (not just “Show more options”), the Explorer needs to be wired up with Command Handler registration.
Disabling Modern Standby (S0 mode) and enabling the Standard Sleep (S3 mode) would not work on many modern laptops (because many OEMs are disabling the S3 mode in firmware) and because of this, a PowerShell script to do this was not provided. Only the registry edit scripts were provided, the EnableS3Standby_NormalSleep.reg for enabling the normal sleep mode, and DisableS0Standby_ModernStandby.reg to disable the Modern Standby (which, if it works, may result in crashing computer when sleep mode is entered via UI or buttons / closing the lid of a laptop). Some links are in the first registry file. See also:
- Getting back S3 sleep and disabling modern standby under Windows 10 >=2004 (Reddit)
- Disable Modern Standby in Windows 10 and Windows 11 (ElevenForum)
- Some General Resources for Windows Admin & Hacks:
- Windows 11 Tutorials (Winareo) - many useful Registry settings and other Windows hacks
- ElevenForum List of Topics (topics, tutorials and hacks for Windows 11 and other computer-related)
- E.g. useful for Win not updating any more:
Script: HideTaskbar.ps1
Script does currently not work: although it attempts to set the specific registry value, after verification, the value has not changed.
To verify what this specific value is, evaluate the following expression in PowerShell:
(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3" -Name Settings).Settings[8]- Basis: from this Reddit, the last link:
- No taskbar on Windows, see the last answer from Sengupta; this may actually be about completely removing the taskbar (?).
- Or: this post, method 3 or method 4.
- This may be outdated or serve a different purpose maybe, e.g. for removing the taskbar rather than auto-hiding it.
A different approach (editing a different registry key):
In Registry Editor (Win-R, regedit), go to
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, set TaskbarDa to 0 for hidden, 1 for visible. Q: is this for temporarily hiding or permanently removing the taskbar?
Another variant from here (methodunder No. 3): In registy, navigate to Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, then on the right pane, right-click any space and click New, then DWORD (32-bit) Value, and name the new DWORD AutoHideTaskbar.
In UI, hide / unhide the taskbar via Settings/Personalization/Taskbar/Taskbar Behaviors/Automatically hide the taskbar.
Script AddToContextMenu.ps1, which adds a certain command to the Explorer's context menu. For example, "Open with VS Code".
Patameters:
- Title (e.g. "Open with VS Code")
- Command (e.g.
"C:\\Users\\YourUserName\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" "%V"to open directories,"...\\Code.exe" "%1"for files) - Icon (optional) - you can set it to the path of executable, e.g.
"C:\\Users\\YourUserName\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
See: