@echo off
if /I %0 EQU "%~dpnx0" (set LAUNCH=1) else (set LAUNCH=0)
set PROP=HideNewOutlookToggle
set KEY=Microsoft\Office\16.0\Outlook\Options\General
set ARGS=/v %PROP% /t REG_DWORD /d 1 /f
echo Disabling New Outlook toggle...
reg add HKCU\Software\%KEY% %ARGS% /reg:32 >nul 2>nul
reg add HKCU\Software\Policies\%KEY% %ARGS% /reg:32 >nul 2>nul
reg add HKCU\Software\%KEY% %ARGS% /reg:64 >nul 2>nul
reg add HKCU\Software\Policies\%KEY% %ARGS% /reg:64 >nul 2>nul
if %ERRORLEVEL% GTR 0 (
if %LAUNCH% GTR 0 color 0e
echo ERROR: This script failed to run. Please make sure to Run As Administrator
reg delete HKCU\Software\%KEY% /v %PROP% /f /reg:32 >nul 2>nul
reg delete HKCU\Software\Policies\%KEY% /v %PROP% /f /reg:32 >nul 2>nul
reg delete HKCU\Software\%KEY% /v %PROP% /f /reg:64 >nul 2>nul
reg delete HKCU\Software\Policies\%KEY% /v %PROP% /f /reg:64 >nul 2>nul
echo Changes have been reverted.
if %LAUNCH% GTR 0 pause
goto :EOF
)
echo Successfully disabled New Outlook toggle!
echo Please restart your comptuer.
if %LAUNCH% GTR 0 pause