-:: nsis compiler needs to be in path\r
-if(.%3)==(.dist) echo echo ==== GENERATE DISTRIBUTION BEGIN ==== >> compile.bat\r
-if(.%3)==(.dist) echo makensis.exe /DPlatform=test docs\Radegast-installer.nsi >> compile.bat\r
-if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat\r
-if(.%3)==(.dist) echo 7z.exe a -tzip dist\Radegast-dist.zip @docs\distfiles.lst >> compile.bat\r
-if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat\r
+if not (.%2)==(.dist) goto NODIST\r
+echo echo ==== GENERATE DISTRIBUTION BEGIN ==== >> compile.bat\r
+copy Radegast\radegast.nsi bin\r
+echo del /q Radegast-*-installer.exe >> compile.bat\r
+echo del /q radegast-latest.zip >> compile.bat\r
+\r
+if not exist "%PROGRAMFILES%\NSIS\Unicode\makensis.exe" goto NOUNINSIS\r
+echo "%PROGRAMFILES%\NSIS\Unicode\makensis.exe" bin\radegast.nsi >> compile.bat\r
+goto NONSIS\r
+:NOUNINSIS\r
+\r
+if not exist "%PROGRAMFILES%\NSIS\makensis.exe" goto NONSIS\r
+echo "%PROGRAMFILES%\NSIS\makensis.exe" bin\radegast.nsi >> compile.bat\r
+:NONSIS\r
+\r
+echo cd bin >> compile.bat\r
+echo 7z.exe a -r -tzip ..\radegast-latest.zip *.* >> compile.bat\r
+echo cd .. >> compile.bat\r
+\r
+:NODIST\r