)\r
\r
@rem Create version.h.\r
-@echo>version.h #define NSSM_VERSION _T("%description%")\r
-@echo>>version.h #define NSSM_VERSIONINFO %major%,%minor%,%n%,%BUILD_NUMBER%\r
-@echo>>version.h #define NSSM_DATE _T("%DATE%")\r
-@echo>>version.h #define NSSM_FILEFLAGS %flags%\r
-@echo>>version.h #define NSSM_COPYRIGHT _T("(c) 2003-%year% Iain Patterson")\r
+@echo>version.h.new #define NSSM_VERSION _T("%description%")\r
+@echo>>version.h.new #define NSSM_VERSIONINFO %major%,%minor%,%n%,%BUILD_NUMBER%\r
+@echo>>version.h.new #define NSSM_DATE _T("%DATE%")\r
+@echo>>version.h.new #define NSSM_FILEFLAGS %flags%\r
+@echo>>version.h.new #define NSSM_COPYRIGHT _T("(c) 2003-%year% Iain Patterson")\r
+\r
+fc version.h version.h.new >NUL: 2>NUL:\r
+if %ERRORLEVEL% == 0 (del version.h.new) else (move /y version.h.new version.h)\r