anchor.diff:  
   
   
  -:::::::::::::::::::::
  -:: STAGE 4: Repair :: // Begin jobs
  -:::::::::::::::::::::
  -call functions\log_with_date.bat "   stage_4_repair begin..."
  -
  -
  -:: JOB: MSI installer cleanup
  -title Tron v%TRON_VERSION% [stage_4_repair] [MSI installer cleanup]
  -call functions\log_with_date.bat "    Cleaning up orphaned MSI cache files..."
  -if /i %VERBOSE%==yes (
  -	if /i %DRY_RUN%==no stage_4_repair\msi_cleanup\msizap.exe G!
  +::::::::::::::::::::
  +:: STAGE 5: Patch :: // Begin jobs
  +::::::::::::::::::::
  +call functions\log_with_date.bat "   stage_5_patch begin..."
  +
  +
  +:: Prep task: enable MSI installer in Safe Mode
  +title Tron v%TRON_VERSION% [stage_5_patch] [Prep]
  +if /i %DRY_RUN%==no (
  +	if not "%SAFE_MODE%"=="" reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\%SAFEBOOT_OPTION%\MSIServer" /ve /t reg_sz /d Service /f >nul 2>&1
  +	net start msiserver >nul 2>&1
  +)
  +
  +:: Prep task: check for skip application patches (-sap) flag or variable and skip if used
  +if /i %SKIP_APP_PATCHES%==yes (
  +	call functions\log_with_date.bat " !  SKIP_APP_PATCHES (-sap) set. Skipping all application patches."
  +	goto skip_application_patches
  +)
  +
  +
  +:: JOB: 7-Zip
  +:: spawn SEVENZIP_DETECTED variable, flip it if an existing 7-Zip installation is detected
  +set SEVENZIP_DETECTED=no
  +if exist "%ProgramFiles(x86)%\7-Zip" set SEVENZIP_DETECTED=yes
  +if exist "%ProgramFiles%\7-Zip" set SEVENZIP_DETECTED=yes
  +if %SEVENZIP_DETECTED%==yes (
  +	title Tron v%TRON_VERSION% [stage_5_patch] [Update 7-Zip]
  +	call functions\log_with_date.bat "    7-Zip detected, updating..."
  +	call functions\log_with_date.bat "    Launch job 'Update 7-Zip'..."
  +	setlocal
  +	if /i %DRY_RUN%==no call "stage_5_patch\7-Zip\7-Zip Installer.bat"
  +	endlocal
  +	call functions\log_with_date.bat "    Done."
  +)
  +
  +
  +:: JOB: Adobe Flash Player
  +:: Basic check for existence of a Flash installation. If ANY Flash installation is detected, launch the update script
  +:: The update script has additional checks to only update existing versions (e.g. Chrome vs. Active X) if they exist on the machine
  +set FLASH_DETECTED=no
  +if exist "%windir%\SysWOW64\Macromed\Flash" set FLASH_DETECTED=yes
  +if exist "%windir%\System32\Macromed\Flash" set FLASH_DETECTED=yes
  +if %FLASH_DETECTED%==yes (
  +	title Tron v%TRON_VERSION% [stage_5_patch] [Update Adobe Flash Player]
  +	call functions\log_with_date.bat "    Adobe Flash detected, updating..."
  +	call functions\log_with_date.bat "    Launch job 'Update Adobe Flash Player'..."
  +	setlocal
  +	if /i %DRY_RUN%==no call "stage_5_patch\adobe\flash_player\Adobe Flash Player Installer.bat"
  +	endlocal
  +	call functions\log_with_date.bat "    Done."
  +)
  +
  +
  +:: JOB: Adobe Acrobat Reader DC
  +if exist "%ProgramFiles(x86)%\Adobe\Acrobat Reader DC*" (
  +	title Tron v%TRON_VERSION% [stage_5_patch] [Update Adobe Reader]
  +	call functions\log_with_date.bat "    Adobe Acrobat Reader DC detected, updating..."
  +	call functions\log_with_date.bat "    Launch job 'Update Acrobat Reader DC'..."
  +	setlocal
  +	if /i %DRY_RUN%==no call "stage_5_patch\adobe\reader_dc\Adobe Acrobat Reader DC.bat"
  +	endlocal
  +	call functions\log_with_date.bat "    Done."
  +)
  +
  +
  +:: JOB: Java Runtime update
  +:: spawn JAVA_DETECTED variable, flip it if an existing JRE installation is detected
  +:: We don't need to worry about architecture because the JRE installer script handles that
  +set JAVA_DETECTED=no
  +if exist "%ProgramFiles(x86)%\Java\jre*" set JAVA_DETECTED=yes
  +if exist "%ProgramFiles%\Java\jre*" set JAVA_DETECTED=yes
  +if %JAVA_DETECTED%==yes (
  +	title Tron v%TRON_VERSION% [stage_5_patch] [Update Java Runtime Environment]
  +	call functions\log_with_date.bat "    Java Runtime detected, updating..."
  +	call functions\log_with_date.bat "    Launch job 'Update Java Runtime Environment'..."
  +	call functions\log_with_date.bat "    Checking for and removing outdated installations first..."
  +	if /i "%DRY_RUN%"=="no" (
  +		REM EXPOSITION DUMP: OK, so all JRE runtimes (series 4-8) use certain GUIDs that increment with each new update (e.g. Update 66)
  +		REM This makes it easy to catch ALL of them through liberal use of WMI wildcards ("_" is single character, "%" is any number of characters)
  +		REM Additionally, JRE 6 introduced 64-bit runtimes, so in addition to the two-digit Update XX revision number, we also check for the architecture
  +		REM type, which always equals '32' or '64'. The first wildcard is the architecture, the second is the revision/update number.
  +
  +		REM JRE 8
  +		REM Skip JRE 8 because the JRE 8 update script automatically removes older versions of 8, no need to do it twice
  +
  +		REM JRE 7
  +		call functions\log_with_date.bat "    JRE 7..."
  +		%WMIC% product where "IdentifyingNumber like '{26A24AE4-039D-4CA4-87B4-2F___170__FF}'" call uninstall /nointeractive >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +
  +		REM JRE 6
  +		call functions\log_with_date.bat "    JRE 6..."
  +		REM 1st line is for updates 23-xx, after Oracle introduced 64-bit runtimes
  +		REM 2nd line is for updates 1-22, before 64-bit JRE 6 runtimes existed
  +		%WMIC% product where "IdentifyingNumber like '{26A24AE4-039D-4CA4-87B4-2F8__160__FF}'" call uninstall /nointeractive >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +		%WMIC% product where "IdentifyingNumber like '{3248F0A8-6813-11D6-A77B-00B0D0160__0}'" call uninstall /nointeractive >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +
  +		REM JRE 5
  +		call functions\log_with_date.bat "    JRE 5..."
  +		%WMIC% product where "IdentifyingNumber like '{3248F0A8-6813-11D6-A77B-00B0D0150__0}'" call uninstall /nointeractive >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +
  +		REM JRE 4
  +		call functions\log_with_date.bat "    JRE 4..."
  +		%WMIC% product where "IdentifyingNumber like '{7148F0A8-6813-11D6-A77B-00B0D0142__0}'" call uninstall /nointeractive >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +
  +		call functions\log_with_date.bat "    Done."
  +
  +
  +		REM Install the latest version
  +		call functions\log_with_date.bat "    Installing latest JRE..."
  +		setlocal
  +		call "stage_5_patch\java\jre\jre-8-installer.bat"
  +		endlocal
  +	)
  +call functions\log_with_date.bat "    Done."
  +)
  +
  +
  +:: JOB: Skip point for if -sap (skip application patches) flag was used
  +:skip_application_patches
  +
  +
  +:: JOB: Windows updates
  +if /i %SKIP_WINDOWS_UPDATES%==no (
  +	title Tron v%TRON_VERSION% [stage_5_patch] [Windows Updates]
  +	call functions\log_with_date.bat "    Launch job 'Install Windows updates'..."
  +
  +	:: Detect if bundled WSUS Offline updates are included. If so, execute those instead
  +	if exist stage_5_patch\wsus_offline\client\Update.cmd (
  +		if /i %SKIP_WSUS_OFFLINE%==no (
  +			title Tron v%TRON_VERSION% [stage_5_patch] [WSUS Offline Updates]
  +			call functions\log_with_date.bat " !  WSUS Offline updates detected. Using bundled update package..."
  +			if /i %DRY_RUN%==no call "stage_5_patch\wsus_offline\client\Update.cmd" >> "%LOGPATH%\%LOGFILE%" 2>&1
  +		) else (
  +			call functions\log_with_date.bat " !  WSUS Offline updates detected, but SKIP_WSUS_OFFLINE (-swo) set."
  +			call functions\log_with_date.bat "    Using regular online update method..."
  +			if /i %DRY_RUN%==no (
  +				sc config wuauserv start= demand>> "%LOGPATH%\%LOGFILE%" 2>NUL
  +				net start wuauserv >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +				wuauclt /detectnow /updatenow >> "%LOGPATH%\%LOGFILE%" 2>NUL
  +				ping 127.0.0.1 -n 15 >nul
  +			)
  +		)
  +	)
  +	call functions\log_with_date.bat "    Done."
   ) else (
  -	if /i %DRY_RUN%==no stage_4_repair\msi_cleanup\msizap.exe G! >> "%LOGPATH%\%LOGFILE%" 2>&1
  -)
  -call functions\log_with_date.bat "    Done."
  -
  -
  -:: JOB: Check Windows Image for corruptions (Windows 8 and up)
  -if %WIN_VER_NUM% geq 6.2 (
  -	title Tron v%TRON_VERSION% [stage_4_repair] [DISM Check]
  -	call functions\log_with_date.bat "    Launch job 'DISM Windows image check'..."
  -	if /i %DRY_RUN%==yes goto skip_dism_image_check
  -	Dism /Online /NoRestart /Cleanup-Image /ScanHealth /Logpath:"%RAW_LOGS%\dism_check.log"
  -)
  -
  -:: If we detect errors try to repair them
  -if not %ERRORLEVEL%==0 (
  -	title Tron v%TRON_VERSION% [stage_4_repair] [DISM Repair]
  -	if %WIN_VER_NUM% geq 6.2 (
  -		call functions\log_with_date.bat " !  DISM: Image corruption detected. Attempting repair..."
  -		:: Add /LimitAccess flag to this command to prevent connecting to Windows Update for replacement files
  -		Dism /Online /NoRestart /Cleanup-Image /RestoreHealth /Logpath:"%RAW_LOGS%\dism_repair.log"
  +	call functions\log_with_date.bat " !  SKIP_WINDOWS_UPDATES (-swu) set. Skipping all Windows Update methods."
  +)
  +
  +
  +:: JOB: Rebuild Windows Update base (deflates the SxS store; note that any Windows Updates installed prior to this point will no longer be uninstallable)
  +:: Windows 8/2012 and up only
  +if %SKIP_DISM_CLEANUP%==no (
  +	title Tron v%TRON_VERSION% [stage_5_patch] [Rebuild Windows Update base]
  +	call functions\log_with_date.bat "    Launch job 'DISM base reset'..."
  +	if /i %DRY_RUN%==no (
  +		REM 7/2008R2 and up
  +		if %WIN_VER_NUM% geq 6.1 (
  +			Dism /online /Cleanup-Image /StartComponentCleanup /ResetBase /Logpath:"%LOGPATH%\dism_base_reset.log" >nul 2>&1
  +			type "%LOGPATH%\dism_base_reset.log" >> "%LOGPATH%\%LOGFILE%"
  +			del /f /q "%LOGPATH%\dism_base_reset.log"
  +		)
  +		REM Vista version
  +		if %WIN_VER_NUM% equ 6.0 (
  +			Dism /online /Cleanup-Image /StartComponentCleanup /Logpath:"%LOGPATH%\dism_base_reset.log" >nul 2>&1
  +			type "%LOGPATH%\dism_base_reset.log" >> "%LOGPATH%\%LOGFILE%"
  +			del /f /q "%LOGPATH%\dism_base_reset.log"
  +		)
   	)
   ) else (
  -	call functions\log_with_date.bat "    DISM: No image corruption detected."
  -)
  -
  -:: Add the DISM logs to the main Tron log
  -if %WIN_VER_NUM% gtr 6.2 (
  -	call functions\log_with_date.bat "    Compiling DISM logs into main Tron log..."
  -	if exist "%RAW_LOGS%\dism_check.log" type "%RAW_LOGS%\dism_check.log" >> "%LOGPATH%\%LOGFILE%"
  -	if exist "%RAW_LOGS%\dism_repair.log" type "%RAW_LOGS%\dism_repair.log" >> "%LOGPATH%\%LOGFILE%"
  -)
  -
  -:skip_dism_image_check
  +	call functions\log_with_date.bat " !  SKIP_DISM_CLEANUP (-sdc) set. Skipping DISM cleanup."
  +)
  +
   call functions\log_with_date.bat "    Done."
   
   
  -:: JOB: System File Checker (SFC) scan
  -title Tron v%TRON_VERSION% [stage_4_repair] [SFC Scan]
  -call functions\log_with_date.bat "    Launch job 'System File Checker'..."
  -if /i %DRY_RUN%==no (
  -	REM Basically this says "If OS is NOT XP or 2003, go ahead and run system file checker." We skip SFC on XP/2k3 because it forces a reboot
  -	if %WIN_VER_NUM% geq 6.0 (
  -		%SystemRoot%\System32\sfc.exe /scannow
  -		%SystemRoot%\System32\findstr.exe /c:"[SR]" %SystemRoot%\logs\cbs\cbs.log>> "%LOGPATH%\%LOGFILE%" 2>NUL
  -	)
  -)
  -call functions\log_with_date.bat "    Done."
  -
  -
  -:: JOB: chkdsk the system drive
  -title Tron v%TRON_VERSION% [stage_4_repair] [chkdsk]
  -call functions\log_with_date.bat "    Launch job 'chkdsk'..."
  -call functions\log_with_date.bat "    Checking %SystemDrive% for errors..."
  -:: Run a read-only scan and look for errors. Schedule a scan at next reboot if errors found
  -if /i %DRY_RUN%==no %SystemRoot%\System32\chkdsk.exe %SystemDrive%
  -if /i not %ERRORLEVEL%==0 (
  -	call functions\log_with_date.bat " !  Errors found on %SystemDrive%. Scheduling full chkdsk at next reboot."
  -	if /i %DRY_RUN%==no fsutil dirty set %SystemDrive%
  -) else (
  -	call functions\log_with_date.bat "    No errors found on %SystemDrive%. Skipping full chkdsk at next reboot."
  -)
  -call functions\log_with_date.bat "    Done."
  -
  -
  -:: JOB: Remove Microsoft telemetry (user tracking)
  -title Tron v%TRON_VERSION% [stage_4_repair] [disable MS telemetry]
  -if /i %SKIP_TELEMETRY_REMOVAL%==yes (
  -	call functions\log_with_date.bat " !  SKIP_TELEMETRY_REMOVAL (-str) set. Disabling instead of removing."
  -	REM Only disable telemetry, don't completely purge it
  -	if %VERBOSE%==yes (
  -		REM GPO options to disable telemetry
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f
  -		
  -		REM Keylogger
  -		%windir%\system32\reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\AutoLogger-Diagtrack-Listener" /v "Start" /t REG_DWORD /d "0" /f
  -		
  -		REM Wifi sense, a nasty one privacy-wise
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\wcmsvc\wifinetworkmanager" /v "wifisensecredshared" /t REG_DWORD /d "0" /f
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\wcmsvc\wifinetworkmanager" /v "wifisenseopen" /t REG_DWORD /d "0" /f
  -		
  -		REM Windows Defender sample reporting
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\windows defender\spynet" /v "spynetreporting" /t REG_DWORD /d "0" /f
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\windows defender\spynet" /v "submitsamplesconsent" /t REG_DWORD /d "0" /f
  -		
  -		REM SkyDrive
  -		%windir%\system32\reg.exe add "HKLM\software\policies\microsoft\windows\skydrive" /v "disablefilesync" /t REG_DWORD /d "1" /f
  -		
  -		REM Kill OneDrive from hooking into Explorer even when disabled
  -		%windir%\system32\reg.exe add "HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d "0" /f
  -		%windir%\system32\reg.exe add "HKCR\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d "0" /f
  -		
  -		REM DiagTrack service
  -		%windir%\system32\reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack" /v "Start" /t REG_DWORD /d "4" /f
  -		
  -		REM "WAP Push Message Routing Service"
  -		%windir%\system32\reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice" /v "Start" /t REG_DWORD /d "4" /f
  -	) else (
  -		REM GPO options to disable telemetry
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM Keylogger
  -		%windir%\system32\reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\AutoLogger-Diagtrack-Listener" /v "Start" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM Wifi sense, a nasty one privacy-wise
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\wcmsvc\wifinetworkmanager" /v "wifisensecredshared" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\wcmsvc\wifinetworkmanager" /v "wifisenseopen" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM Windows Defender sample reporting
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\windows defender\spynet" /v "spynetreporting" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		%windir%\system32\reg.exe add "HKLM\software\microsoft\windows defender\spynet" /v "submitsamplesconsent" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM SkyDrive
  -		%windir%\system32\reg.exe add "HKLM\software\policies\microsoft\windows\skydrive" /v "disablefilesync" /t REG_DWORD /d "1" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM Kill OneDrive from hooking into Explorer even when disabled
  -		%windir%\system32\reg.exe add "HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		%windir%\system32\reg.exe add "HKCR\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d "0" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM DiagTrack service
  -		%windir%\system32\reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack" /v "Start" /t REG_DWORD /d "4" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -		
  -		REM "WAP Push Message Routing Service"
  -		%windir%\system32\reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice" /v "Start" /t REG_DWORD /d "4" /f >> "%LOGPATH%\%LOGFILE%" 2>&1
  -	)
  -	goto skip_telem_removal
  -)
  -
  -:: Windows 10 version
  -if /i "%WIN_VER:~0,9%"=="Windows 1" (
  -	call functions\log_with_date.bat "    Launch job 'Kill Microsoft telemetry (user tracking) (Win10)'..."
  -	call functions\log_with_date.bat "    THIS TAKES A WHILE - BE PATIENT!!"
  -	if /i %DRY_RUN%==no call stage_4_repair\disable_windows_telemetry\purge_windows_10_telemetry.bat
  -	call functions\log_with_date.bat "    Done. Enjoy your privacy."
  -)
  -
  -:: Spawn temporary variable to check for Win7 and 8. Ugly hack but at least it works
  -set RUN_7_OR_8_TELEM=no
  -if /i "%WIN_VER:~0,9%"=="Windows 7" set RUN_7_OR_8_TELEM=yes
  -if /i "%WIN_VER:~0,9%"=="Windows 8" set RUN_7_OR_8_TELEM=yes
  -if /i "%WIN_VER:~0,19%"=="Windows Server 2012" set RUN_7_OR_8_TELEM=yes
  -if /i "%RUN_7_OR_8_TELEM%"=="yes" (
  -	call functions\log_with_date.bat "    Launch job 'Kill Microsoft telemetry (user tracking) (Win7/8/8.1)'..."
  -	if /i %DRY_RUN%==no call stage_4_repair\disable_windows_telemetry\purge_windows_7-8-81_telemetry.bat
  -	call functions\log_with_date.bat "    Done. Enjoy your privacy."
  -)
  -:skip_telem_removal
  -
  -
  -:: JOB: Disable Windows 10 Upgrade (Win7/8/8.1 only)
  -:: Just re-use the temp variable from the above job since it will tell us whether we're on 7 or 8
  -if /i "%RUN_7_OR_8_TELEM%"=="yes" (
  -	call functions\log_with_date.bat "    Launch job 'Disable Windows 10 Upgrade nagger (Win7/8/8.1)'..."
  -	if /i %DRY_RUN%==no ( 
  -		REM Only disable telemetry, don't completely purge it
  -		REM "DisableOSUpgrade" disables/hides the taskbar app to prevent users from making a reservation and upgrading manually
  -		REM  However, user can still get updated automatically with KB3146449
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f
  -	
  -		REM "AllowOSUpgrade" is the holy grail that will actually prevent the upgrade from happening, even if Win10 is sitting in the update folder. 
  -		REM You can make a reservation, download it via updates, enable this option and windows will never automatically/manually update to Win10.
  -		REM "ReservationsAllowed" is a little more heavy handed and may not be neccessary. This actually prevents the user (or windows) from making a
  -		REM reservation and downloading the upgrade even remotely possible...but the upgrade can still happen if it's already downloaded. Usually done 
  -		REM on new installs as an extra preventative measure. The default value for this is 2. Setting it to 0 makes reservations impossible.
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" /v "AllowOSUpgrade" /t REG_DWORD /d "0" /f
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" /v "ReservationsAllowed" /t REG_DWORD /d "0" /f
  -	
  -		REM "DisableGWX" is the upgrade nagger/popup
  -		%windir%\system32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\GWX" /v "DisableGWX" /t REG_DWORD /d "1" /f
  -	)
  -	call functions\log_with_date.bat "    Done."
  -)
  -
  -
  -:: JOB: Disable NVIDIA telemetry (sigh...)
  -title Tron v%TRON_VERSION% [stage_4_repair] [disable NVIDIA telemetry]
  -call functions\log_with_date.bat "    Launch job 'Disable NVIDIA telemetry'..."
  -if /i %DRY_RUN%==no (
  -	schtasks /delete /F /TN "\NvTmMon_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}" >> "%LOGPATH%\%LOGFILE%" 2>&1
  -	schtasks /delete /F /TN "\NvTmRep_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}" >> "%LOGPATH%\%LOGFILE%" 2>&1
  -	schtasks /delete /F /TN "\NvTmRepOnLogon_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}" >> "%LOGPATH%\%LOGFILE%" 2>&1
  -)
  -call functions\log_with_date.bat "    Done."
  -
  -
  -:: JOB: Network repair (minor)
  -title Tron v%TRON_VERSION% [stage_4_repair] [winsock_reset]
  -call functions\log_with_date.bat "    Launch job 'Network repair'..."
  -if /i %DRY_RUN%==no (
  -	ipconfig /flushdns >> "%LOGPATH%\%LOGFILE%" 2>&1
  -	:: Below command probably not necessary, but just in case there are dodgy static ARP entries
  -	netsh interface ip delete arpcache >> "%LOGPATH%\%LOGFILE%" 2>&1
  -	netsh winsock reset catalog >> "%LOGPATH%\%LOGFILE%" 2>&1
  -)
  -call functions\log_with_date.bat "    Done."
  -
  -
  -:: JOB: Repair file extensions
  -title Tron v%TRON_VERSION% [stage_4_repair] [repair file extensions]
  -call functions\log_with_date.bat "    Launch job 'Repair file extensions'..."
  -if /i %DRY_RUN%==no (
  -	setlocal
  -	call stage_4_repair\repair_file_extensions\repair_file_extensions.bat
  -	endlocal
  -)
  -call functions\log_with_date.bat "    Done."
  -
  -
  -
   
   
   :: Stage complete
  -call functions\log_with_date.bat "   stage_4_repair complete."
  +call functions\log_with_date.bat "   stage_5_patch complete."
  
positive.code: :::::::::::::::::::::
  :: PREP AND CHECKS ::
  :::::::::::::::::::::
  set STAGE_4_SCRIPT_VERSION=1.2.3
  set STAGE_4_SCRIPT_DATE=2017-03-02
  
  :: Check for standalone vs. Tron execution and build the environment if running in standalone mode
  if /i "%LOGFILE%"=="" (
  	pushd ..
  	
  	:: Load the settings file
  	call functions\tron_settings.bat
  
  
negative.code: :: Purpose:       Sub-script containing all commands for Tron's Stage 5: Patch stage. Called by tron.bat and returns control when finished
  :: Requirements:  1. Administrator access
  ::                2. Safe mode is recommended but not required
  :: Author:        vocatus on reddit.com/r/TronScript ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2
  :: Version:       1.1.8 ! Fix bug in WSUS Offline update code due to unused variable. Thanks to /u/gayuha
  ::                1.1.7 * Update date/time logging functions to use new log_with_date.bat. Thanks to /u/DudeManFoo for suggestion
  ::                1.1.6 * Update script to support standalone execution
  ::                      + Add support for bundled WSUS Offline updates. Thanks to /u/TootZoot for initial template code
  ::                      / change :skip_updates and associated GOTO statements to :skip_application_updates
  ::                      / change various text and strings referring to SKIP_UPDATES to SKIP_APP_UPDATES
  ::                1.1.5 * Update verbage on installation of Adobe Reader to reflect new Reader DC installation
  ::                      ! Minor bug fix; don't display "done" message if no Java installation was detected or updated
  ::                1.1.4 * Improve Windows Update section; force start Windows Update service in case it's not running, prior to running the wuaserv command
  ::                1.1.3 ! Fix bug where 7ZIP_DETECTED variable would never get set because it started with a number. Rename to SEVENZIP_DETECTED. Thanks to /u/toomasmolder
  ::                      / Change some comments inside parentheses to use REM instead of ::. Thanks to /u/toomasmolder
  ::                1.1.2 + Import Windows Vista/2008 Dism component cleanup from Stage 4
  ::                      + Implement support for -sdc switch (SKIP_DISM_CLEANUP)
  ::                1.1.1 - Remove internal log function and switch to Tron's external logging function. Thanks to github:nemchik
  ::                1.1.0 * Only patch each program if it already exists on the system. Thanks to /u/Tech604
  ::                1.0.0 + Initial write
  @echo off
  
  