conditional wubi-no-shift

This commit is contained in:
Klesh Wong 2020-07-22 10:43:35 +08:00
parent 76ff14bc26
commit ddec4019e4

View File

@ -1,10 +1,11 @@
# execute this first
Set-ExecutionPolicy RemoteSigned
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
exit;
}
Set-ExecutionPolicy RemoteSigned
# link config files
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
New-Item -ItemType SymbolicLink -Target $dotfiles\win\profile.ps1 -Path $profile -Force
@ -17,7 +18,9 @@ if (Test-Path $sshconf -PathType Leaf) {
}
# fix Shift key toggling Cn/En fro MS wubi
$wubiAction = New-ScheduledTaskAction -Execute 'Powershell.exe' `
if (-not (Get-ScheduledTask -TaskName "Wubi No Shift")) {
$wubiAction = New-ScheduledTaskAction -Execute 'Powershell.exe' `
-Argument "-NoProfile -WindowStyle Hidden -File $PSScriptRoot\wubi-no-shift.ps1"
$wubiTrigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -Action $wubiAction -Trigger $wubiTrigger -TaskName "Wubi No Shift" -Description "Disable Shift key toggling CN/EN" -RunLevel Highest
$wubiTrigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -Action $wubiAction -Trigger $wubiTrigger -TaskName "Wubi No Shift" -Description "Disable Shift key toggling CN/EN" -RunLevel Highest
}