-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate-AutostartShortcut.ps1
More file actions
28 lines (21 loc) · 987 Bytes
/
Create-AutostartShortcut.ps1
File metadata and controls
28 lines (21 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#Requires -RunAsAdministrator
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ExePath = Join-Path $ScriptDir "dist\activitytracker_app.exe"
$StartupFolder = [Environment]::GetFolderPath([Environment+SpecialFolder]::Startup)
$ShortcutPath = Join-Path $StartupFolder "ActivityTracker.lnk"
if (-not (Test-Path $ExePath)) {
Write-Error "Fehler: Die Datei '$ExePath' wurde nicht gefunden."
Write-Output "Stelle sicher, dass die App gebaut und im dist-Ordner vorhanden ist."
exit 1
}
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = $ExePath
$Shortcut.Arguments = "--minimized"
$Shortcut.Description = "ActivityTracker Dashboard - Lädt minimiert im System-Tray"
$Shortcut.WindowStyle = 7
$Shortcut.Save()
Write-Output "✓ Autostart-Verknüpfung erfolgreich erstellt:"
Write-Output " Ziel: $ExePath"
Write-Output " Argument: --minimized"
Write-Output " Pfad: $ShortcutPath"