-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_start_menu_shortcut.ps1
More file actions
40 lines (34 loc) 路 1.41 KB
/
Copy pathinstall_start_menu_shortcut.ps1
File metadata and controls
40 lines (34 loc) 路 1.41 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
$ErrorActionPreference = "Stop"
$AppName = "StreamVault"
$ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$PythonPath = Join-Path $env:LOCALAPPDATA "Microsoft\WindowsApps\pythonw3.12.exe"
$ConsolePythonPath = Join-Path $env:LOCALAPPDATA "Microsoft\WindowsApps\python3.12.exe"
$LauncherPath = Join-Path $ProjectRoot "launcher.pyw"
$IconPath = Join-Path $ProjectRoot "icons\movie.ico"
$StartMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs"
$ShortcutPath = Join-Path $StartMenuDir "$AppName.lnk"
if (-not (Test-Path -LiteralPath $PythonPath)) {
if (Test-Path -LiteralPath $ConsolePythonPath) {
$PythonPath = $ConsolePythonPath
} else {
throw "Could not find Python 3.12 in $env:LOCALAPPDATA\Microsoft\WindowsApps."
}
}
if (-not (Test-Path -LiteralPath $LauncherPath)) {
throw "Could not find $LauncherPath."
}
if (-not (Test-Path -LiteralPath $IconPath)) {
$IconPath = $PythonPath
}
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($ShortcutPath)
$shortcut.TargetPath = $PythonPath
$shortcut.Arguments = "`"$LauncherPath`""
$shortcut.WorkingDirectory = $ProjectRoot
$shortcut.IconLocation = "$IconPath,0"
$shortcut.Description = "Launch StreamVault"
$shortcut.Save()
Write-Host "Created Start Menu shortcut:"
Write-Host $ShortcutPath
Write-Host ""
Write-Host "Open Start, search StreamVault, then right-click it and choose Pin to Start."