diff --git a/build-telemac-deps.bat b/build-telemac-deps.bat
index ec222feab3465e7b5d9f878f8679da87778906d1..baa20859f1dd840e6e9029e2ff1b81056e131a8a 100644
--- a/build-telemac-deps.bat
+++ b/build-telemac-deps.bat
@@ -17,6 +17,9 @@ if not exist "%~1" (
   mkdir "%~1" || exit /b 0
 )
 
+rem Local variables only
+setlocal
+
 rem Create the installation path
 set install_path=%~1
 mkdir %install_path% 2>nul
@@ -82,6 +85,7 @@ if %compiler% == intel (
 echo Unsupported compiler: %compiler%
 
 :exit
+endlocal
 popd
 color 7
 exit /b 0