set high dpi aware in powershell script instead

This commit is contained in:
Kang Yu 2024-06-02 17:47:04 -07:00
parent cb9e0c8216
commit 4d4e11ce5e
2 changed files with 5 additions and 4 deletions

View file

@ -1,2 +0,0 @@
REG ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /V "%~dp0PersistentWindows.exe" /T REG_SZ /D "~ HIGHDPIAWARE" /F
start "" /B "%~dp0PersistentWindows.exe" %*

View file

@ -1,6 +1,11 @@
## Replace with your desired command arguments
$arguments = "-splash=0"
$executablePath = $PSScriptRoot + "\PersistentWindows.exe"
## create registry to run PersistentWindows.exe in high dpi aware mode
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" -Name $executablePath -Value "~ HIGHDPIAWARE"
## rename the task as you like
$taskName = "StartPersistentWindows" + $env:username
$taskDescription = "This task starts automatically when " + $env:username + " login."
@ -12,8 +17,6 @@ if ($existingTask -ne $null) {
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
}
$executablePath = $PSScriptRoot + "\PersistentWindows.bat"
$action = New-ScheduledTaskAction -Execute $executablePath
$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:username