diff --git a/CMake/otbcli.bat.in b/CMake/otbcli.bat.in
index ffe1fb2a3f4695e6d1377f453cda524d90723bf2..165d8338726754d5f7188bc7ae3ae3e52a41685d 100644
--- a/CMake/otbcli.bat.in
+++ b/CMake/otbcli.bat.in
@@ -16,8 +16,13 @@ if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherCommandLine.exe (
 
 setlocal
 :: works for install tree
-if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
-  set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%OTB_APPLICATION_PATH%
+if exist %CURRENT_SCRIPT_DIR%..\@OTB_INSTALL_APP_DIR_NATIVE@ (
+  set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%..\@OTB_INSTALL_APP_DIR_NATIVE@;%OTB_APPLICATION_PATH%
+)
+
+::set GDAL_DATA, EPSG_CSV and update PATH
+if exist %CURRENT_SCRIPT_DIR%\..\otbenv.cmd (
+    call %CURRENT_SCRIPT_DIR%\..\otbenv.cmd
 )
 
 set LC_NUMERIC=C
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efb8aff8b37eeaa4855f4ab80b6b15d4a7e2d9ae..ec57fa80544f274dd82c59816b66c3fb75c9118e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,6 +134,9 @@ if(NOT OTB_INSTALL_PACKAGE_DIR)
   set(OTB_INSTALL_PACKAGE_DIR "${OTB_INSTALL_LIBRARY_DIR}/cmake/OTB-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
 endif()
 
+#convert path to native for reconfiguring otbcli.bat.in
+file(TO_NATIVE_PATH "${OTB_INSTALL_APP_DIR}" OTB_INSTALL_APP_DIR_NATIVE)
+
 # Override CMake's built-in add_* commands: assign LABELS to tests and targets
 # automatically. Depends on the CMake variable otb-module being set to the
 # "current" module when add_* is called.