Fix for issue 2227 in which unpredictable behavior results from an upgrade or reversion process replacing the upgrade script while the upgrade process is running on Windows. This code will compare the running version of the script with the new version to see whether or not the script actually needs replacing. If so the script is copied with an extension NEW. When the script starts it checks for the existence of upgrade.bat.NEW and if exists prints a message informing the user that they must replace the old version of the script with the new version before continuing.