anchor.diff:  set ^"ARGS=%*^"			&:# Argument line
   setlocal EnableExtensions EnableDelayedExpansion &:# Use the ! expansion now on
   
  +call :Debug.Init
   goto :Main
   
   :#----------------------------------------------------------------------------#
   :# Simple debug framework
   
  -:# Do nothing
  -:nop
  +:Debug.Init
  +set FOREACHLINE=for /f "delims="
  +
  +:# Define a LF variable containing a Line Feed ('\x0A')
  +set LF=^
  +%# The two blank lines here are necessary. #%
  +%# The two blank lines here are necessary. #%
  +
  +:# Define a CR variable containing a Carriage Return ('\x0D')
  +for /f %%a in ('copy /Z %COMSPEC% nul') do set "CR=%%a"
  +
  +:# Define variables for problematic characters, that cause parsing issues.
  +:# Use the ASCII control character name, or the html entity name.
  +:# Warning: The excl and hat characters need different quoting depending on context.
  +set  "#percnt=%%"	&:# One percent sign
  +set  "#excl=^!"		&:# One exclamation mark
  +set  "#hat=^"		&:# One caret, aka. circumflex accent, or hat sign
  +set ^"#quot=""		&:# One double quote
  +set  "#apos='"		&:# One apostrophe
  +set  "#amp=&"		&:# One ampersand
  +set  "#vert=|"		&:# One vertical bar
  +set  "#gt=>"		&:# One greater than sign
  +set  "#lt=<"		&:# One less than sign
  +set  "#sp= "		&:# One space
  +set  "#tab=	"	&:# One tabulation
  +set  "#cr=!CR!"		&:# One carrier return
  +set  "#lf=!LF!"		&:# One line feed
  +
  +set "INDENT="
  +set "+INDENT=call :IncIndent"
  +set "-INDENT=call :DecIndent"
  +set "ECHO=call :Echo"
  +set "COMMENT=%ECHO% :#"
  +set "ERROR=>&2 %ECHO% Error:"
  +set "LOG=call :Log"
  +set "LOGVARS=call :LogVars"
  +set "LOGFILE=NUL"
  +set "RETURN=call :Return"
  +set "EXEC=call :Exec"
  +set "PREPVAR=call :Prep2ExpandVar"
  +
  +:Debug.off
  +set "ECHO.D=call :Log"
  +set "ECHOVARS.D=call :LogVars"
  +set "ENTER=call :Log call %%0 %%* & %+INDENT%"
  +exit /b
  +
  +:Debug.on
  +set "ECHO.D=call :Echo.d"
  +set "ECHOVARS.D=call :EchoVars.d"
  +set "ENTER=call :Echo call %%0 %%* & %+INDENT%"
  +exit /b
  +
  +:# Change the debug output indentation
  +:IncIndent
  +set "INDENT=%INDENT%  "
  +exit /b
  +:DecIndent
  +if defined INDENT set "INDENT=%INDENT:~2%"
   exit /b
   
   :# Trace the return from a subroutine, and do the actual return
   :Return
  -setlocal
  -set "ERR=%~1"
  -if not defined ERR set "ERR=%ERRORLEVEL%"
  -echo   exit /b %ERR%
  -2>NUL (goto) & exit /b %ERR% &:# Pop one call stack, then return to the upper level
  +:# gotcha: setlocal sometimes clears %ERRORLEVEL%, so the reading must be on same line
  +setlocal & set "ERR=%~1" & if not defined ERR set "ERR=%ERRORLEVEL%"
  +%ECHO.D% exit /b %ERR%
  +endlocal & 2>NUL (goto) & %-INDENT% & exit /b %ERR% &:# Pop one call stack, then return to the upper level
   
   :# Display and log the definition of a multiple variables
   :EchoVars.d
  -for %%v in (%*) do echo set %%v=!%%v!
  +for %%v in (%*) do echo %INDENT%set "%%v=!%%v!"
   :LogVars
  -for %%v in (%*) do %LOG% set %%v=!%%v!
  +for %%v in (%*) do %LOG% set "%%v=!%%v!"
   exit /b
   
   :# Display and log a message
   :Echo
  -echo %*
  -%LOG% %*
  -exit /b
  -
  -:# Display and log a batch comment
  -:Comment
  -%ECHO% :# %*
  -exit /b
  -
  -:# Display a message, with a timestamp, into the log file
  +setlocal EnableDelayedExpansion
  +set ^"MSG=%*^"
  +echo.!MSG!
  +goto :Log.Msg
  +
  +:# Display and log a debug message
  +:Echo.d
  +setlocal EnableDelayedExpansion
  +set ^"MSG=%*^"
  +echo.%INDENT%!MSG!
  +goto :Log.Msg
  +
  +:# Log a message, with a timestamp, into the log file
   :Log
  -setlocal DisableDelayedExpansion
  +setlocal EnableDelayedExpansion
  +set ^"MSG=%*^"
  +:Log.Msg
   call :Now
   set "NOW=%YEAR%-%MONTH%-%DAY% %HOUR%:%MINUTE%:%SECOND%.%MS%"
  ->>"%LOGFILE%" echo %NOW% %*
  -endlocal
  -exit /b
  +>>"%LOGFILE%" echo %NOW% %INDENT%!MSG!
  +endlocal & exit /b
   
   :# Display and log a batch command, and run it.
   :Exec
   %ECHO% %*
   %*
  +exit /b
  +
  +:# Prepare one variable, in a local scope with !expansion! either on or off, for %expansion% in another scope with !expansion! on
  +:Prep2ExpandVar     INVAR [OUTVAR]
  +:# TO DO: Test and manage the case when the local expansion is off
  +:# Prepare one variable, in a local scope with !expansion! on, for %expansion% in another scope with !expansion! on
  +:Prep2ExpandVar.Eon INVAR [OUTVAR]
  +if not [%2]==[] (
  +  set "%~2="
  +  if defined %1 set "%~2=!%~1!"
  +  shift
  +) &:# Fallthrough into :Prep2ExpandVars.Eon
  +:# Prepare variables, in a local scope with !expansion! on, for %expansion% in another scope with !expansion! on
  +:Prep2ExpandVars.Eon VAR [VAR ...]
  +if defined %1 (
  +  for %%e in (sp tab cr lf quot amp vert lt gt hat percnt) do ( :# Encode named character entities
  +    for %%c in ("!#%%e!") do (
  +      set "%~1=!%~1:%%~c= #%%e !"
  +    )
  +  )
  +  call set "%~1=%%%~1:^!= #excl %%" 	& rem :# Encode exclamation points
  +  call set "%~1=%%%~1: =^!%%"		& rem :# Encode final expandable entities
  +)
  +if not [%2]==[] shift & goto :Prep2ExpandVars.Eon
   exit /b
   
   :#----------------------------------------------------------------------------#
  
positive.code: if [%1]==[] goto :start
  if [%1]==[/?] goto :help
  if [%1]==[-?] goto :help
  if [%1]==[-d] set "ECHO.D=call :Echo" & set "ECHOVARS.D=call :EchoVars.d" & set "RETURN=call :Return" & goto :next_arg
  if [%1]==[-V] (echo %VERSION%) & exit /b 0
  if [%1]==[-X] set "EXEC=echo" & goto :next_arg
  if [%1]==[-y] set "QUIET=1" & goto :next_arg
  >&2 echo Error: Unexpected argument: %1
  exit /b 1
  
  :start
  cd "%SPATH%"
  
  :# Get this new instance version
  call :GetAgVersion "win32\ag.exe"
  
negative.code: exit /b
  
  :CompareInteger %1=Integer1 %2=Integer2
  if "%1%2"=="" exit /b 0				&:# They're both empty, thus equal
  if "%2"=="" exit /b 1				&:# Integer1 > nothing
  if "%1"=="" exit /b -1				&:# nothing < Integer2
  setlocal
  set /a "DIFF=%1-%2"
  if "%DIFF%"=="0" endlocal & exit /b 0		&:# They're equal
  if "%DIFF:-=%"=="%DIFF%" endlocal & exit /b 1	&:# Integer1 > Integer2
  endlocal & exit /b -1				&:# Integer1 < Integer2
  
  :CompareVersions %1=Version1 %2=Version2
  %ENTER%
  setlocal
  call :SplitVer %1 V1MAJOR V1MINOR V1PATCH V1BUILD
  call :SplitVer %2 V2MAJOR V2MINOR V2PATCH V2BUILD
  call :CompareInteger %V1MAJOR% %V2MAJOR%
  