diff --git a/CMakeLists.txt b/CMakeLists.txt
index d53ea8e93a6f2fc92b96588d372fd2dcf541ca96..9885bb055e64af4df52c66fc6e76d921a8064099 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,5 +20,7 @@ endif()
 
 # Execute and Copy during installation
 install(DIRECTORY python_src DESTINATION  ${CMAKE_INSTALL_PREFIX})
+if(UNIX)
 install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_diapOTBEnv.sh ${CMAKE_INSTALL_PREFIX})")
 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/diapOTBEnv.sh PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${CMAKE_INSTALL_PREFIX})
+endif()