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

Commit: 
https://github.com/vim/vim/commit/7784fac15f7ae729b4422c5efc2db48bd15a8548
Author: K.Takata <[email protected]>
Date:   Mon May 11 16:56:33 2026 +0000

    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/msvc-latest.bat b/src/msvc-latest.bat
index 4529fa02e..93ac70570 100644
--- a/src/msvc-latest.bat
+++ b/src/msvc-latest.bat
@@ -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 cvarsall.bat" (
-       call "%InstallDir%\VC\Auxiliary\Build cvarsall.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 cvarsall.bat" (
        call "%InstallDir%\VC\Auxiliary\Build cvarsall.bat" %*
@@ -60,7 +58,14 @@ if exist "%InstallDir%\VC\Auxiliary\Build cvarsall.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=
diff --git a/src/msvc2015.bat b/src/msvc2015.bat
index b541719ac..2ee864ca6 100644
--- a/src/msvc2015.bat
+++ b/src/msvc2015.bat
@@ -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 cvarsall.bat" (
+       echo Error: vcvarsall.bat not found.
+       exit /b 1
+)
 call "%VS140COMNTOOLS%..\..\VC cvarsall.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
+       )
+)
diff --git a/src/msvc2017.bat b/src/msvc2017.bat
index c7731c92c..569eddd15 100644
--- a/src/msvc2017.bat
+++ b/src/msvc2017.bat
@@ -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%
+)
diff --git a/src/msvc2019.bat b/src/msvc2019.bat
index a45ef2c56..16a893f1d 100644
--- a/src/msvc2019.bat
+++ b/src/msvc2019.bat
@@ -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%
+)
diff --git a/src/msvc2022.bat b/src/msvc2022.bat
index b70741007..67a9491b6 100644
--- a/src/msvc2022.bat
+++ b/src/msvc2022.bat
@@ -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%
+)
diff --git a/src/version.c b/src/version.c
index f96e170e4..9240b0995 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    474,
 /**/
     473,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wMUDf-00HMKZ-Pu%40256bit.org.

Raspunde prin e-mail lui