2024-10-01 15:11:03 +02:00
|
|
|
|
<#
|
2021-11-12 12:45:13 +01:00
|
|
|
|
.SYNOPSIS
|
2023-08-24 14:10:36 +02:00
|
|
|
|
Launches Visual Studio
|
2021-11-12 12:45:13 +01:00
|
|
|
|
.DESCRIPTION
|
2023-08-24 14:10:36 +02:00
|
|
|
|
This PowerShell script launches the Microsoft Visual Studio application.
|
2021-11-12 12:45:13 +01:00
|
|
|
|
.EXAMPLE
|
2023-08-24 14:10:36 +02:00
|
|
|
|
PS> ./open-visual-studio.ps1
|
2021-11-12 12:45:13 +01:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-09-06 21:42:04 +02:00
|
|
|
|
.NOTES
|
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-11-12 12:45:13 +01:00
|
|
|
|
#>
|
|
|
|
|
|
2023-08-24 14:10:36 +02:00
|
|
|
|
function tryToLaunch { param($filePath)
|
|
|
|
|
if (Test-Path "$filePath" -pathType leaf) {
|
|
|
|
|
Start-Process "$filePath"
|
2021-11-12 12:45:13 +01:00
|
|
|
|
exit 0 # success
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2023-08-24 14:10:36 +02:00
|
|
|
|
tryToLaunch "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
|
|
|
|
|
tryToLaunch "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"
|
2021-11-12 12:45:13 +01:00
|
|
|
|
exit 0 # success
|
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-11-12 12:45:13 +01:00
|
|
|
|
exit 1
|
|
|
|
|
}
|