patch 9.2.0474: MS-Windows: hard to tell which Visual Studio version was selected with MSVC

Problem:  When running msvc*.bat there is no indication of which
          Visual Studio version and target architecture got
          selected.
Solution: After vcvarsall.bat returns, echo the VS version, VC
          tools version and target architecture, and set the
          Command Prompt title accordingly (Ken Takata).

closes: #20193

Signed-off-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
K.Takata
2026-05-11 16:56:33 +00:00
committed by Christian Brabandt
parent a70b7a85af
commit 7784fac15f
6 changed files with 43 additions and 10 deletions
+15 -10
View File
@@ -39,18 +39,16 @@ if "%VSVEROPT%"=="" (
)
rem Search Visual Studio Community, Professional or above.
set InstallDir=
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set InstallDir=%%i
)
if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" (
call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %*
goto done
)
rem Search Visual Studio 2017 Express.
rem (Visual Studio 2017 Express uses different component IDs.)
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products Microsoft.VisualStudio.Product.WDExpress -property installationPath`) do (
set InstallDir=%%i
if not defined InstallDir (
rem Search Visual Studio 2017 Express.
rem (Visual Studio 2017 Express uses different component IDs.)
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products Microsoft.VisualStudio.Product.WDExpress -property installationPath`) do (
set InstallDir=%%i
)
)
if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" (
call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %*
@@ -60,7 +58,14 @@ if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" (
call
)
:done
if defined VCToolsVersion (
if "%VSVEROPT%"=="-latest" (
echo VCTools %VCToolsVersion% %VSCMD_ARG_TGT_ARCH%
for /f "tokens=1,2 delims=." %%I in ("%VCToolsVersion%") do (
title VCTools %%I.%%J %VSCMD_ARG_TGT_ARCH%
)
)
)
if "%VSWHERE_SET%"=="yes" (
set VSWHERE=
set VSWHERE_SET=
+14
View File
@@ -12,4 +12,18 @@ rem If you use Community (or Professional) edition, you can also use "x64"
rem option:
rem msvc2015 x64
set Platform=
if not exist "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" (
echo Error: vcvarsall.bat not found.
exit /b 1
)
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %*
if defined VisualStudioVersion (
if defined Platform (
echo VS 2015 ^(%VisualStudioVersion%^) %Platform%
title VS 2015 %Platform%
) else (
echo VS 2015 ^(%VisualStudioVersion%^) x86
title VS 2015 x86
)
)
+4
View File
@@ -11,3 +11,7 @@ rem msvc2017 x86_amd64
set "VSVEROPT=-version [15.0^,16.0^)"
call "%~dp0msvc-latest.bat" %*
set VSVEROPT=
if defined VCToolsVersion (
echo VS 2017 ^(%VCToolsVersion%^) %VSCMD_ARG_TGT_ARCH%
title VS 2017 %VSCMD_ARG_TGT_ARCH%
)
+4
View File
@@ -11,3 +11,7 @@ rem msvc2019 x64
set "VSVEROPT=-version [16.0^,17.0^)"
call "%~dp0msvc-latest.bat" %*
set VSVEROPT=
if defined VCToolsVersion (
echo VS 2019 ^(%VCToolsVersion%^) %VSCMD_ARG_TGT_ARCH%
title VS 2019 %VSCMD_ARG_TGT_ARCH%
)
+4
View File
@@ -11,3 +11,7 @@ rem msvc2022 x64
set "VSVEROPT=-version [17.0^,18.0^)"
call "%~dp0msvc-latest.bat" %*
set VSVEROPT=
if defined VCToolsVersion (
echo VS 2022 ^(%VCToolsVersion%^) %VSCMD_ARG_TGT_ARCH%
title VS 2022 %VSCMD_ARG_TGT_ARCH%
)
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
474,
/**/
473,
/**/