diff --git a/app/windows/kdevelop-msvc.bat b/app/windows/kdevelop-msvc.bat --- a/app/windows/kdevelop-msvc.bat +++ b/app/windows/kdevelop-msvc.bat @@ -3,16 +3,14 @@ setlocal enabledelayedexpansion setlocal enableextensions -REM Check for newest VS (2017) too. These variables are defined if the script is run from Developer Command Prompt -IF NOT DEFINED VS150COMNTOOLS ( - REM load Visual Studio 2017 developer command prompt if VS150COMNTOOLS is not set. It's ugly and hardcoded too. - for %%n in (Enterprise Professional Community BuildTools) do ( - set "p=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\%%n\Common7\Tools\" - if exist "!p!\VsDevCmd.bat" ( - set "VS150COMNTOOLS=!p!" - goto :end - ) - ) +REM load Visual Studio 2017 developer command prompt if VS150COMNTOOLS isn't set. Read Windows registry in case VS is not istalled on C:\ +for /f "usebackq tokens=3*" %%a in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /s`) do ( + set vs15_path=%%a %%b + if exist "!vs15_path!Common7\Tools\VsDevCmd.bat" ( + set "VS150COMNTOOLS=!vs15_path!Common7\Tools\" + goto :end + ) + ) ) :end