anchor.diff:  ::                      -x   Self-destruct. Tron deletes itself after running and leaves logs intact
   ::
   ::                If you don't like the defaults and don't want to use the command-line, edit the variables below to change the script defaults.
  -
  +::
   ::                U.S. Army Warrant Officer Corps - Quiet Professionals
   
   
   :: TODO:  
  -::   - GSL: Fix list of removed programs not being empty if no programs were removed:   https://www.reddit.com/r/TronScript/comments/312i81/tron_removed_programstxt_contains_a_list_of_all/
  -::   - 
  +::  -gsl   Fix list of removed programs not being empty if no programs were removed: ( https://www.reddit.com/r/TronScript/comments/312i81/tron_removed_programstxt_contains_a_list_of_all/ )
  +::         Currently stuck, can't figure out why ERRORLEVEL isn't getting set correctly, even when using enabledelayedexpansion and !ERRORLEVEL! in testing.
  +::         If anyone can point me in the right direction it'd be great. Boilerplate code is in and currently commented out.
  +::  7-zip  Look at v1.2.0-TRON x86 install script, /u/swtester reported it throwing out "file could not be found" errors ( http://www.reddit.com/r/TronScript/comments/31axc6/tron_v612_20150403_add_np_flag_def_updates/cq208ly )
   
   SETLOCAL
   @echo off
  
positive.code: :::::::::::::::::::::
  cls
  color 0f
  set SCRIPT_VERSION=6.1.2
  set SCRIPT_DATE=2015-04-xx
  title TRON v%SCRIPT_VERSION% (%SCRIPT_DATE%)
  
  :: Initialize script-internal variables. Most of these get clobbered later so don't change them here
  
negative.code: if /i %GENERATE_SUMMARY_LOGS%==yes (
  title TRON v%SCRIPT_VERSION% [stage_6_wrap-up] [Generate Summary Logs]
  call :log "%CUR_DATE% %TIME%    Summary logs requested, calculating post-run results..."
  if /i %DRY_RUN%==no (
  	:: Get list of installed programs
  	stage_0_prep\log_tools\siv\siv32x.exe -save=[software]="%RAW_LOGS%\installed-programs-after.txt"
  	:: Get list of all files
  	stage_0_prep\log_tools\everything\everything.exe -create-filelist %RAW_LOGS%\filelist-after.txt %SystemDrive%
  	:: Parse everything
  		REM Step 1: Find FILES that were deleted (second line is to strip everything trailing the first comma from the output)
  		stage_0_prep\log_tools\comm\comm.exe -23 %RAW_LOGS%\filelist-before.txt %RAW_LOGS%\filelist-after.txt | find /i /v "$RECYCLE" | find /i /v "AppData\" | find /i /v "ntuser.dat" > %TEMP%\temp.txt
  		for /f "tokens=1 delims=," %%a in (%TEMP%\temp.txt) do echo %%a >> %SUMMARY_LOGS%\tron_removed_files.txt
  
  		REM Step 2: Find PROGRAMS that were removed. This is super ugly and complicated, but lets us avoid bundling another external utility
  		REM Compact the files by removing blank lines, stripping top 4 lines off file, then last two lines, then output to the final text file for comparison
  		copy /y %RAW_LOGS%\installed-programs-before.txt %RAW_LOGS%\before.txt >NUL
  		for /f "delims=" %%a in (%RAW_LOGS%\before.txt) do echo %%a>> %RAW_LOGS%\before1.txt
  		more +3 %RAW_LOGS%\before1.txt >> %RAW_LOGS%\before2.txt
  		findstr /v /i "[==" %RAW_LOGS%\before2.txt > %RAW_LOGS%\installed-programs-before.txt
  
  		REM AFTER: Compact the files by removing blank lines, stripping top 4 lines off file, then last two lines, then output to the final text file for comparison
  		copy /y %RAW_LOGS%\installed-programs-after.txt %RAW_LOGS%\after.txt >NUL
  		for /f "delims=" %%a in (%RAW_LOGS%\after.txt) do echo %%a>> %RAW_LOGS%\after1.txt
  		more +3 %RAW_LOGS%\after1.txt >> %RAW_LOGS%\after2.txt
  		findstr /v /i "[==" %RAW_LOGS%\after2.txt > %RAW_LOGS%\installed-programs-after.txt
  
  		REM Calculate differences, using GnuWin32 coreutil's comm.exe
  		stage_0_prep\log_tools\comm\comm.exe -23 %RAW_LOGS%\installed-programs-before.txt %RAW_LOGS%\installed-programs-after.txt > %SUMMARY_LOGS%\tron_removed_programs.txt
  
  		REM This currently doesn't work - if anyone knows how to fix it, please let me know. Errorlevel doesn't get set correctly, and using SETLOCAL ENABLEDELAYEDEXPANSION doesn't seem to help
  		REM If the parsed file is the same size as the original, we can assume it's the same size and nothing was removed, so just echo that into the file
  		REM echo n|COMP %RAW_LOGS%\installed-programs-before.txt %RAW_LOGS%\installed-programs-after.txt >NUL
  		REM if !ERRORLEVEL!==0 echo No programs were removed.> %SUMMARY_LOGS%\tron_removed_programs.txt
  		
  		REM Cleanup
  		del /f /q %TEMP%\temp.txt 2>NUL
  		del /f /q %RAW_LOGS%\before*txt 2>NUL
  		del /f /q %RAW_LOGS%\after*txt 2>NUL
  	)
  call :log "%CUR_DATE% %TIME%    Done. Summary logs are at "%SUMMARY_LOGS%\"
  )
  