conditional wubi-no-shift
This commit is contained in:
parent
76ff14bc26
commit
ddec4019e4
|
@ -1,10 +1,11 @@
|
||||||
|
# execute this first
|
||||||
|
Set-ExecutionPolicy RemoteSigned
|
||||||
|
|
||||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
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';`"";
|
Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-ExecutionPolicy RemoteSigned
|
|
||||||
|
|
||||||
# link config files
|
# link config files
|
||||||
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
|
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
|
||||||
New-Item -ItemType SymbolicLink -Target $dotfiles\win\profile.ps1 -Path $profile -Force
|
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
|
# fix Shift key toggling Cn/En fro MS wubi
|
||||||
|
if (-not (Get-ScheduledTask -TaskName "Wubi No Shift")) {
|
||||||
$wubiAction = New-ScheduledTaskAction -Execute 'Powershell.exe' `
|
$wubiAction = New-ScheduledTaskAction -Execute 'Powershell.exe' `
|
||||||
-Argument "-NoProfile -WindowStyle Hidden -File $PSScriptRoot\wubi-no-shift.ps1"
|
-Argument "-NoProfile -WindowStyle Hidden -File $PSScriptRoot\wubi-no-shift.ps1"
|
||||||
$wubiTrigger = New-ScheduledTaskTrigger -AtLogOn
|
$wubiTrigger = New-ScheduledTaskTrigger -AtLogOn
|
||||||
Register-ScheduledTask -Action $wubiAction -Trigger $wubiTrigger -TaskName "Wubi No Shift" -Description "Disable Shift key toggling CN/EN" -RunLevel Highest
|
Register-ScheduledTask -Action $wubiAction -Trigger $wubiTrigger -TaskName "Wubi No Shift" -Description "Disable Shift key toggling CN/EN" -RunLevel Highest
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user