From 4c85e8b2f12842212c6f1d2dcdd2ab9e6d466827 Mon Sep 17 00:00:00 2001 From: Andrey Luzhin <62383996+xpam-net@users.noreply.github.com> Date: Fri, 29 Oct 2021 09:13:35 +0200 Subject: [PATCH] Fix a problem with an ampersand character in path If the path variable contained values with an ampersand character (such as in the case of MySQL), the string splits by this character, and tries to execute what follows as a separate command. All occurrences of the set command containing %PATH% should be wrapped in quotation marks --- vendor/lib/lib_path.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 725b549..3a807ad 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -74,7 +74,7 @@ exit /b set "find_query=%add_to_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" - set OLD_PATH=%PATH% + set "OLD_PATH=%PATH%" setlocal enabledelayedexpansion if "!found!" == "0" ( @@ -121,8 +121,8 @@ exit /b exit /b :toolong - echo %OLD_PATH%>tempfileA - echo %PATH%>tempfileB + echo "%OLD_PATH%">tempfileA + echo "%PATH%">tempfileB fc /b tempfileA tempfileB 2>nul 1>nul if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) del tempfileA & del tempfileB