Created
February 3, 2023 08:43
-
-
Save TTTPOB/43c61820aae59474bc0c294f0a9294af to your computer and use it in GitHub Desktop.
process msedge browser shortcut and registry entry, to enable overlay scrollbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scrollbar args | |
$scrollbar_args = "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation" | |
# ms edge lnk path | |
$desktop_lnk = "C:\Users\Public\Desktop\Microsoft Edge.lnk" | |
$start_lnk = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" | |
# registry path | |
$reg_path = "HKCR\MSEdgeHTM\shell" | |
function Set-EdgeScrollbar([string]$path, [string]$args_) { | |
$shell = New-Object -ComObject WScript.Shell | |
$shortcut = $shell.CreateShortcut($path) | |
$shortcut.Arguments = $args_ | |
$shortcut.Save() | |
} | |
Set-EdgeScrollbar -path $desktop_lnk -args_ $scrollbar_args | |
Set-EdgeScrollbar -path $start_lnk -args_ $scrollbar_args | |
# insert the scrobar args to registry item $reg_path\open\command\Default, the arguments should be the first one after the path | |
function Set-EdgeScrollbarReg([string]$path, [string]$args_) { | |
$regpath = "Registry::" + $path | |
$reg = Get-ItemProperty -Path $regpath | |
# replace '.exe"' with '.exe" $args_' | |
$sub_target='.exe" ' + $args_ | |
$new_default = $reg."(default)" -replace '\.exe"' , $sub_target | |
# write back to registry | |
Set-ItemProperty -Path $regpath -Name "(default)" -Value $new_default | |
} | |
Set-EdgeScrollbarReg -path $reg_path"\open\command" -args_ $scrollbar_args | |
Set-EdgeScrollbarReg -path $reg_path"\runas\command" -args_ $scrollbar_args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment