-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_launcher.ps1
46 lines (41 loc) · 1.48 KB
/
app_launcher.ps1
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
41
42
43
44
45
46
# Quick Application Launcher
function Show-Menu {
Clear-Host
Write-Host "Quick Application Launcher" -ForegroundColor Green
Write-Host "==========================" -ForegroundColor Green
Write-Host "1. Open Visual Studio Code"
Write-Host "2. Open Microsoft Word"
Write-Host "3. Open Microsoft Edge (GitHub)"
Write-Host "4. Open File Explorer"
Write-Host "5. Exit"
}
function Launch-Application {
param (
[string]$choice
)
switch ($choice) {
1 {
# Attempt to launch Visual Studio Code from default installation paths
$vsCodePath1 = "C:\Program Files\Microsoft VS Code\Code.exe"
$vsCodePath2 = "C:\Program Files (x86)\Microsoft VS Code\Code.exe"
if (Test-Path $vsCodePath1) {
Start-Process $vsCodePath1
} elseif (Test-Path $vsCodePath2) {
Start-Process $vsCodePath2
} else {
Write-Host "Visual Studio Code not found. Please check your installation." -ForegroundColor Red
}
}
2 { Start-Process "winword.exe" }
3 { Start-Process "msedge.exe" "https://www.github.com" }
4 { Start-Process "explorer.exe" }
5 { exit }
default { Write-Host "Invalid selection. Please try again." -ForegroundColor Red }
}
}
do {
Show-Menu
$choice = Read-Host "Select an option"
Launch-Application -choice $choice
Start-Sleep -Seconds 2
} while ($choice -ne 5)