anchor.diff:  :#                  Display a notice and stop if there's no mounted image.    #
   :#   2013-11-12 JFL Use my latest debugging framework.                        #
   :#                  Fixed bug in detection of mount RW/RO mode.               #
  +:#   2018-06-14 JFL Fixed bug with default /commit or /discard.		      #
  +:#                  Fixed bug if the mount point is relative or has no drive. #
   :#                                                                            #
   :#          Copyright 2018 Hewlett Packard Enterprise Development LP         #
   :# Licensed under the Apache 2.0 license  www.apache.org/licenses/LICENSE-2.0 #
   :##############################################################################
   
   setlocal enableextensions enabledelayedexpansion
  -set "VERSION=2013-11-12"
  +set "VERSION=2018-06-14"
   set "SCRIPT=%~nx0"
   set "ARG0=%~f0"
   
  
positive.code: )
  
  :# Default changes saving: Based on the image mount mode (RO or RW)
  if .%COMMIT%.==.. (
    for /l %%n in (0,1,%LAST_MWI%) do (
      set N=%%n
      call set DIR=%%MWI!N!.DIR%%
      call set MODE=%%MWI!N!.MODE%%
      if "!DIR!"=="%MNTPT%" (
        if "!MODE!"=="RW" (
        	set COMMIT=commit
        ) else (
        	set COMMIT=discard
        )
      )
      %ECHOVARS.D% N DIR MODE COMMIT
  
negative.code: :# In verbose mode, remove the dism /Quiet option
  %IF_VERBOSE% set "DISMOPT=%DISMOPT: /Quiet=%"
  %ECHO% Unmounting image from %MNTPT%
  %EXEC% dism%DISMOPT% /Unmount-Wim /MountDir:"%MNTPT%" %/COMMIT%
  
  