@echo off if not .%2==. goto begin echo. echo Requires PKZIP25.EXE echo. echo This batch compresses all files in current directory and echo below into a zip file and creates a batch file that unzips echo the files into a temp directory, runs the specified file, echo then removes the files after updating the zip if any changes. echo. echo Usage: DIRCOMP filebase runfile [destdir] echo Filebase should not have extension or path, echo creates filebase.zip and filebase.bat in destdir echo If destdir isn't specified, creates files in root echo If naming a root dir, specify like d: (not d:\) echo. echo Example: DIRCOMP webpage index.htm d:\myfiles goto end :begin if not exist %3\nul md %3 if exist %3\nul goto compile echo cannot create destdir goto end :compile echo Compiling... pkzip25>nul -add -dir %3\%1.zip echo> %3\%1.bat @echo off echo>>%3\%1.bat md %1.tmp echo>>%3\%1.bat if not exist %1.tmp\nul goto end echo>>%3\%1.bat pkzip25 -ext -dir -ove %1.zip %1.tmp echo>>%3\%1.bat dir /-p /s %1.tmp %% "%% | find /v "dir(s)" > %% "%% %1.dir echo>>%3\%1.bat cls echo>>%3\%1.bat echo. echo>>%3\%1.bat echo Launching %2 echo>>%3\%1.bat echo Waiting for application to end echo>>%3\%1.bat cd %1.tmp echo>>%3\%1.bat start /w %2 echo>>%3\%1.bat cd .. echo>>%3\%1.bat dir /-p /s %1.tmp %% "%% | find /v "dir(s)" > %% "%% %1.cmp echo>>%3\%1.bat fc %1.cmp %1.dir %% "%% | %% "%% find "FC: no diff" echo>>%3\%1.bat if not errorlevel 1 goto cleanup echo>>%3\%1.bat cd %1.tmp echo>>%3\%1.bat pkzip25 -add=update -dir ..\%1.zip echo>>%3\%1.bat cd .. echo>>%3\%1.bat :cleanup echo>>%3\%1.bat deltree /y %1.tmp echo>>%3\%1.bat del %1.cmp echo>>%3\%1.bat del %1.dir echo>>%3\%1.bat cls echo>>%3\%1.bat :end :end