-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ps1
28 lines (24 loc) · 901 Bytes
/
install.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
# Define the source directory containing the scripts
$scriptDir = Join-Path -Path $HOME -ChildPath "dotfiles\scripts"
# Check if script directory exists
if (-Not (Test-Path $scriptDir)) {
Write-Host "Script directory does not exist: $scriptDir"
exit
}
# Get all .ps1 scripts in the script directory
$scripts = Get-ChildItem -Path $scriptDir -Filter *.ps1
foreach ($script in $scripts) {
$scriptPath = $script.FullName
$confirmation = Read-Host "Do you want to run the script $($script.Name)? (yes/no)"
if ($confirmation -eq "yes" -or $confirmation -eq "y" -or $confirmation -eq "Y") {
Write-Host "Running script: $scriptPath"
try {
# Execute the script
& $scriptPath
} catch {
Write-Host "An error occurred while running $scriptPath $_"
}
} else {
Write-Host "Skipped script: $scriptPath"
}
}