diff --git a/win32/ifchange.bat b/win32/ifchange.bat index 24e4987c55..1444d1bc2f 100755 --- a/win32/ifchange.bat +++ b/win32/ifchange.bat @@ -2,6 +2,7 @@ :: usage: ifchange target temporary set timestamp= +set keepsuffix= :optloop for %%I in (%1) do set opt=%%~I if "%opt%" == "--timestamp" ( @@ -12,6 +13,14 @@ if "%opt%" == "--timestamp" ( set timestamp=%opt:~12% shift goto :optloop +) else if "%opt%" == "--keep" ( + set keepsuffix=.old + shift + goto :optloop +) else if "%opt:~0,7%" == "--keep=" ( + set keepsuffix=%opt:~7% + shift + goto :optloop ) if "%opt%" == "" goto :end @@ -51,6 +60,7 @@ echo assuming %1 should be changed. echo %1 updated. :: if exist %1 del %1 dir /b %2 +if "%keepsuffix%" != "" %1 %1%keepsuffix% copy %2 %1 del %2 goto :end