Skip to content

Instantly share code, notes, and snippets.

@voidbar
Created April 14, 2022 07:41
Show Gist options
  • Save voidbar/025f707dbc1f3039bcd9f12ef9389330 to your computer and use it in GitHub Desktop.
Save voidbar/025f707dbc1f3039bcd9f12ef9389330 to your computer and use it in GitHub Desktop.
Modern MSVC open developer shell script using Powershell
# Require `Install-Module VSSetup -Scope CurrentUser`
function vsdev
{
param(
[int] $Version = 16 # VS 2019
)
$vspath = Get-VSSetupInstance | where { $_.InstallationVersion.Major -eq $Version } | select -first 1 -ExpandProperty InstallationPath
Import-Module "$vspath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" && Enter-VsDevShell -VsInstallPath $vspath -SkipAutomaticLocation -DevCmdArguments '-arch=x64'
}
# ❯ vsdev 16
# **********************************************************************
# ** Visual Studio 2019 Developer PowerShell v16.11.11
# ** Copyright (c) 2021 Microsoft Corporation
# **********************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment