@Echo OFF IF "%~1"=="" GOTO :Stop REM _revision file.mscz OR file.mscx REM _revision.awk sets the "revision" metaTag based on modified date of the .mscx/.mscz file REM _revision.sed fixes some temporary issues REM .awk/.sed files should reside in the same folder REM and have the same name as the .bat file (%0) IF "%~x1"==".mscx" GOTO :MSCX IF "%~x1"==".mscz" GOTO :MSCZ GOTO :Stop :MSCX gawk -f "%~dpn0.awk" "%~1" | sed -f "%~dpn0.sed" | sed -b -e "s/\r//g" > "%~dp1.$msc$tmp%~x1" touch --reference="%~1" "%~dp1.$msc$tmp%~x1" REN "%~1" ".%~nx1," REN "%~dp1.$msc$tmp%~x1" "%~nx1" GOTO :Stop :MSCZ IF NOT EXIST "%TEMP%\.$msc$tmp\*" MD "%TEMP%\.$msc$tmp\" > NUL IF EXIST "%TEMP%\.$msc$tmp\*.mscx*" DEL "%TEMP%\.$msc$tmp\*.mscx*" /Q /S > NUL call winrar X "%~1" *.mscx "%TEMP%\.$msc$tmp\" COPY "%~1" "%~dp1.%~nx1," /Y > NUL FOR %%f in ("%TEMP%\.$msc$tmp\*.mscx") DO ( gawk -f "%~dpn0.awk" "%%~f" | sed -f "%~dpn0.sed" | sed -b -e "s/\r//g" > "%%~dpf.$msc$tmp%%~xf" touch --reference="%%~f" "%%~dpf.$msc$tmp%%~xf" REN "%%~f" ".%%~nxf," REN "%%~dpf.$msc$tmp%%~xf" "%%~nxf" call winrar A -tk -ep -m5 "%~1" "%%~f" ) DEL "%TEMP%\.$msc$tmp\*.mscx*" /Q /S > NUL RD "%TEMP%\.$msc$tmp\" /Q /S GOTO Stop :STOP