Skip to content

Instantly share code, notes, and snippets.

@TTTPOB
Created February 3, 2023 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TTTPOB/43c61820aae59474bc0c294f0a9294af to your computer and use it in GitHub Desktop.
Save TTTPOB/43c61820aae59474bc0c294f0a9294af to your computer and use it in GitHub Desktop.
process msedge browser shortcut and registry entry, to enable overlay scrollbar
# 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