Last active
October 2, 2019 16:55
-
-
Save vcheckzen/060eac215b2786521675a172111ffffa to your computer and use it in GitHub Desktop.
Windows 10 1903 and Later Search To Center
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
$BASE_PATH = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' | |
$RADIUS_PATH = "$BASE_PATH\Flighting\Override" | |
function CustimizedNewItemProperty($Path, $Name, $Value) { | |
$null = New-ItemProperty -Path $Path -Name $Name -PropertyType DWord -Value $Value | |
} | |
function ToCenter($Radius) { | |
$null = ToDefault | |
$null = New-Item -ItemType String -Path $RADIUS_PATH | |
CustimizedNewItemProperty $BASE_PATH ImmersiveSearch 1 | |
CustimizedNewItemProperty $RADIUS_PATH ImmersiveSearchFull 1 | |
CustimizedNewItemProperty $RADIUS_PATH CenterScreenRoundedCornerRadius $Radius | |
'设置成功' | |
} | |
function ToDefault { | |
if (Test-Path -Path $RADIUS_PATH) { | |
$null = Remove-Item -Path $RADIUS_PATH -Recurse -Force | |
} | |
if ($null -ne (Get-ItemProperty -Path $BASE_PATH | Select-String -Pattern "ImmersiveSearch")) { | |
$null = Remove-ItemProperty -Path $BASE_PATH -Name ImmersiveSearch -Force | |
} | |
'恢复完成' | |
} | |
function Menu { | |
Clear-Host | |
@" | |
---------------------------- | |
Windows 10 1903 and Later | |
Search 居中脚本 | |
V0.01 2019.10.02 | |
@AUTHOR LOGI | |
---------------------------- | |
0. 退出 | |
1. 居中 | |
2. 恢复 | |
---------------------------- | |
"@ | |
switch (Read-Host '请选择') { | |
0 { Exit 0 } | |
1 { | |
try { | |
ToCenter ([int](Read-Host '请输入圆角大小(0-10)')) | |
} | |
catch { | |
ToCenter 0 | |
} | |
} | |
2 { ToDefault } | |
Default { Menu } | |
} | |
} | |
while ($true) { | |
Menu | |
'----------------------------' | |
'请按任意键继续...' | |
[void][System.Console]::ReadKey($true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment