@ECHO OFF :: Check Windows version and command line arguments IF "%OS%"=="Windows_NT" (SETLOCAL) ELSE (GOTO Syntax) IF NOT "%~1"=="" GOTO Syntax VER | FIND "Windows 2000" >NUL IF ERRORLEVEL 1 GOTO Syntax :: Check admin access SET Domain=/DOMAIN FOR /F "tokens=2*" %%A IN ('NET CONFIG WORKSTATION 2^>NUL ^| FIND /I "Logon domain "') DO IF /I "%%B"=="%ComputerName%" SET Domain= SET Admin=0 NET USER %UserName% %Domain% 2>NUL | FIND "*" | FIND /I "Admin" >NUL IF ERRORLEVEL 1 ( FOR /F "tokens=*" %%A IN ('NET LOCALGROUP Administrators 2^>NUL ^| FIND /I "%UserName%"') DO FOR %%a IN (%%A) DO IF /I "%%~a"=="%UserName%" SET Admin=1 ) ELSE ( SET Admin=1 ) IF NOT [%Admin%]==[1] ( CLS ECHO. ECHO This batch file requires administrative permissions on the local computer. ECHO You do not seem to have these permissions. ECHO If continue without the right permissions the procedure will probably fail ECHO halfway through. SET /P Answer=Are you sure you want to try anyway? [y/N] ) IF NOT [%Admin%]==[1] IF /I NOT [%Answer%]==[Y] GOTO Syntax :Disclaimer CLS ECHO. ECHO You are about to uninstall Outlook Express from your computer. ECHO. ECHO This uninstall procedure involves editing the registry and removing ECHO system files and directories. ECHO The procedure has been tested only once, on my own computer running ECHO Windows 2000 Professional (UK) Service Pack 4. ECHO. ECHO If you would ask Microsoft about editing the registry or removing ECHO system files, they would probably advise against it. So do I. ECHO So if you insist on using this batch file you do so at your own risk. ECHO. ECHO By using this script you accept full responsibility for any damage ECHO it may cause! ECHO. ECHO Type YES if you have read and understood this disclaimer and accept ECHO full responsibility, otherwise press Enter to abort. ECHO. SET /P Answer= IF [%Answer%]==[YES] GOTO Go ECHO. ECHO [Aborted on user's request] GOTO:EOF :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: Note: Throughout this script the variable ERRORDESCR contains a short :: :: description of the possible cause if the following commands fail. :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :Go :: Check the exact locations of the files to be removed SET OutlookExpDir=%ProgramFiles%\Outlook Express SET ErrorDescr=Directory %OutlookExpDir% not found IF NOT EXIST "%OutlookExpDir%" GOTO Error SET System32Dir=%WinDir%\System32 SET ErrorDescr=Directory %System32Dir% not found IF NOT EXIST "%System32Dir%" GOTO Error SET DllCacheDir=%System32Dir%\DllCache SET ErrorDescr=Directory %DllCacheDir% not found IF NOT EXIST "%DllCacheDir%" GOTO Error :: Create a directory to store files and directories to be removed SET ArchiveDir=%ProgramFiles%\OutlookUninstArchive IF NOT EXIST "%ArchiveDir%" MD "%ArchiveDir%" SET ErrorDescr=Directory %ArchiveDir% could not be created IF NOT EXIST "%ArchiveDir%" GOTO Error :: Create a list of files to be removed > "%ArchiveDir%\Outlook_files.txt" ECHO %System32Dir%\inetcomm.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\inetcomm.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %System32Dir%\msoeacct.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\msoeacct.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %System32Dir%\msoert2.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\msoert2.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\msoe.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\msoe.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\msoeres.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\msoeres.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\msimn.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\msimn.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\oeimport.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\oeimport.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\oemiglib.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\oemiglib.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\oemig50.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\oemig50.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\setup50.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\setup50.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\wab.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\wab.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\wabfind.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\wabfind.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\wabimp.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\wabimp.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\wabmig.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\wabmig.exe >> "%ArchiveDir%\Outlook_files.txt" ECHO %OutlookExpDir%\csapi3t1.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\csapi3t1.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %CommonProgramFiles%\System\directdb.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\directdb.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %CommonProgramFiles%\System\wab32.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\wab32.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %CommonProgramFiles%\System\wab32res.dll >> "%ArchiveDir%\Outlook_files.txt" ECHO %DllCacheDir%\wab32res.dll :: Check if all files from the list are there, abort if not SET AllFilesExist=0 SET ErrorDescr=One or more files were missing IF EXIST "%ArchiveDir%\Outlook_files.txt" SET AllFilesExist=1 FOR /F "tokens=* delims=" %%A IN ('TYPE "%ArchiveDir%\Outlook_files.txt"') DO IF NOT EXIST "%%~A" ( SET AllFilesExist=0 ECHO File not found: "%%~A" ) IF NOT [%AllFilesExist%]==[1] GOTO Error :: Create a list of directories to be removed > "%ArchiveDir%\Outlook_dirs.txt" ECHO %CommonProgramFiles%\Microsoft Shared\Stationery >> "%ArchiveDir%\Outlook_dirs.txt" ECHO %UserProfile%\Application Data\Identities >> "%ArchiveDir%\Outlook_dirs.txt" ECHO %UserProfile%\Local Settings\Application Data\Identities >> "%ArchiveDir%\Outlook_dirs.txt" ECHO %UserProfile%\Application Data\Microsoft\Address Book >> "%ArchiveDir%\Outlook_dirs.txt" ECHO %UserProfile%\Local Settings\Application Data\Address Book :: Check if all directories from the list are there, abort if not SET AllDirsExist=0 SET ErrorDescr=One or more directories were missing IF EXIST "%ArchiveDir%\Outlook_dirs.txt" SET AllDirsExist=1 FOR /F "tokens=* delims=" %%A IN ('TYPE "%ArchiveDir%\Outlook_dirs.txt"') DO IF NOT EXIST "%%~A\." ( ECHO.%%~A | FIND /I "%UserProfile%" >NUL IF ERRORLEVEL 1 SET AllDirsExist=0 ECHO Directory not found: "%%~A" ) IF NOT [%AllDirsExist%]==[1] GOTO Error :: Create a directory to store export files of registry keys to be removed IF NOT EXIST "%ArchiveDir%\Registry" MD "%ArchiveDir%\Registry" SET ErrorDescr=Directory %ArchiveDir%\Registry could not be created IF NOT EXIST "%ArchiveDir%\Registry" GOTO Error :: Create a list of registry entries to be removed > "%ArchiveDir%\Outlook.del" ECHO REGEDIT4 >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_LOCAL_MACHINE\Software\Microsoft\Outlook Express] >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_LOCAL_MACHINE\Software\Microsoft\WAB] >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_CURRENT_USER\Identities] >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_CURRENT_USER\Software\Microsoft\Outlook Express] >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_CURRENT_USER\Software\Microsoft\WAB] >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}] >> "%ArchiveDir%\Outlook.del" ECHO. >> "%ArchiveDir%\Outlook.del" ECHO [-HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{7790769C-0471-11D2-AF11-00C04FA35D02}] >> "%ArchiveDir%\Outlook.del" ECHO. :: Export the registry entries to be removed, abort on failure SET AllRegExist=0 SET ErrorDescr= IF EXIST "%ArchiveDir%\Outlook.del" SET AllRegExist=1 CALL :ExportReg "HKLM_OutlookExpress.reg" "HKEY_LOCAL_MACHINE\Software\Microsoft\Outlook Express" CALL :ExportReg "HKLM_WAB.reg" "HKEY_LOCAL_MACHINE\Software\Microsoft\WAB" CALL :ExportReg "HKCU_Identities.reg" "HKEY_CURRENT_USER\Identities" CALL :ExportReg "HKCU_OutlookExpress.reg" "HKEY_CURRENT_USER\Software\Microsoft\Outlook Express" CALL :ExportReg "HKCU_WAB.reg" "HKEY_CURRENT_USER\Software\Microsoft\WAB" CALL :ExportReg "HKLM_00AA00B6015C.reg" "HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}" CALL :ExportReg "HKLM_00C04FA35D02.reg" "HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{7790769C-0471-11D2-AF11-00C04FA35D02}" IF NOT [%AllRegExist%]==[1] GOTO Error :: Create the directories where the files and directories :: to be removed will be stored, or abort on failure SET AllDirsCreated=1 SET ErrorDescr=One or more directories could not be created FOR /F "tokens=* delims=" %%A IN ('TYPE "%ArchiveDir%\Outlook_files.txt"') DO ( IF NOT EXIST "%ArchiveDir%%%~pA" MD "%ArchiveDir%%%~pA" IF NOT EXIST "%ArchiveDir%%%~pA" ( ECHO Error creating directory "%ArchiveDir%%%~pA" SET AllDirsCreated=0 ) ) FOR /F "tokens=* delims=" %%A IN ('TYPE "%ArchiveDir%\Outlook_dirs.txt"') DO ( IF NOT EXIST "%ArchiveDir%%%~pA" MD "%ArchiveDir%%%~pA" IF NOT EXIST "%ArchiveDir%%%~pA" ( ECHO Error creating directory "%ArchiveDir%%%~pA" SET AllDirsCreated=0 ) ) IF NOT [%AllDirsCreated%]==[1] GOTO Error :: Move the files and directories and remove the registry entries FOR /F "tokens=* delims=" %%A IN ('TYPE "%ArchiveDir%\Outlook_dirs.txt"') DO IF EXIST "%%~A" MOVE /Y "%%~A" "%ArchiveDir%%%~pA" START /WAIT REGEDIT.EXE /S "%ArchiveDir%\Outlook.del" FOR /F "tokens=* delims=" %%A IN ('TYPE "%ArchiveDir%\Outlook_files.txt"') DO IF EXIST "%%~A" MOVE /Y "%%~A" "%ArchiveDir%%%~pA" :: Done ENDLOCAL GOTO:EOF :ExportReg SET RegFile=%~1 SET RegKey=%~2 IF NOT DEFINED RegKey ( SET AllRegExist=0 GOTO:EOF ) SET ErrorDescr=One or more registry keys could not be exported START /WAIT REGEDIT.EXE /E "%ArchiveDir%\Registry\%RegFile%" "%RegKey%" TYPE "%ArchiveDir%\Registry\%RegFile%" 2>NUL | FIND /I "[%RegKey%]" >NUL IF ERRORLEVEL 1 ( SET AllRegExist=0 ECHO Error exporting registry key [%RegKey%] ) GOTO:EOF :Error ECHO. ECHO The batch file encountered at least one error: ECHO.%ErrorDescr% ECHO No files, directories or registry keys were moved or deleted yet. ECHO The process is aborted. :Syntax ECHO. ECHO DelOutlX.bat, Version 0.41 Beta for Windows 2000 ECHO Uninstall Outlook Express from the local computer ECHO. ECHO Usage: DELOUTLX [ /? ] ECHO. ECHO Notes: This batch file requires Administrator rights on the local system. IF DEFINED ArchiveDir ( ECHO The files to be removed are actually stored in the directory ECHO "%ArchiveDir%" ) ECHO. ECHO Warning: This batch file removes system files and registry entries. ECHO This is NOT without risk, to say the least. ECHO Make sure you understand the implications before running this script, ECHO and that you have a full backup of your system, plus the required ECHO software to restore it. ECHO USE THIS BATCH FILE ENTIRELY AT YOUR OWN RISK! ECHO. ECHO Written by Rob van der Woude ECHO http://www.robvanderwoude.com IF "%OS%"=="Windows_NT" ENDLOCAL