Enhance autostart setup with a one-command installer and improve script logic for KVM switch launch

This commit is contained in:
Lago
2026-03-27 16:32:06 +01:00
parent dc3b67d00a
commit 4721e386a0
4 changed files with 71 additions and 17 deletions
+28
View File
@@ -0,0 +1,28 @@
param(
[string]$ShortcutName = "Internal KVM Switch.lnk"
)
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$launcher = Join-Path $scriptDir "start_kvm_switch_background.vbs"
if (-not (Test-Path -LiteralPath $launcher)) {
throw "Launcher not found: $launcher"
}
$startupFolder = [Environment]::GetFolderPath("Startup")
$shortcutPath = Join-Path $startupFolder $ShortcutName
$wscript = New-Object -ComObject WScript.Shell
$shortcut = $wscript.CreateShortcut($shortcutPath)
$shortcut.TargetPath = "$env:WINDIR\System32\wscript.exe"
$shortcut.Arguments = """$launcher"""
$shortcut.WorkingDirectory = $scriptDir
$shortcut.IconLocation = "$env:WINDIR\System32\shell32.dll,220"
$shortcut.Save()
Write-Host "Autostart shortcut created/updated:"
Write-Host " $shortcutPath"
Write-Host "Target launcher:"
Write-Host " $launcher"