Подходит для версий Outlook 2007, 2010, 2013, проверяет версию Office (должен быть установлен).
@echo off setlocal set regexe=%SystemRoot%\System32\Reg.exe set officepath15="%PROGRAMFILES%\Microsoft Office\Office15\excel.exe" set officepath14="%PROGRAMFILES%\Microsoft Office\Office14\excel.exe" set officepath12="%PROGRAMFILES%\Microsoft Office\Office12\excel.exe" if exist %officepath15% (set rkey=HKCU\Software\Microsoft\Office\15.0\Outlook\Security) else ( if exist %officepath14% (set rkey=HKCU\Software\Microsoft\Office\14.0\Outlook\Security) else ( set rkey=HKCU\Software\Microsoft\Office\12.0\Outlook\Security) ) set rvalue="OutlookSecureTempFolder" for /f "Tokens=3*" %%a in ('%regexe% QUERY "%rkey%" /v %rvalue% 2^>NUL') do ( set rdata=%%a set edata=%%b ) set full=%rdata% %edata% echo %full% pause del "%full%\*.*" /f /s /q if %ERRORLEVEL% EQU 0 (echo Outlook temp files deleted...) else (echo No temp files deleted...) ping -n 5 localhost > nul endlocal exit