Skip to content

Instantly share code, notes, and snippets.

@bigjosh
Created May 19, 2018 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigjosh/e62f82125adbe065969393dc674f16c1 to your computer and use it in GitHub Desktop.
Save bigjosh/e62f82125adbe065969393dc674f16c1 to your computer and use it in GitHub Desktop.
REM ***This batch file will automatically run SCANPST on every PST file in the
REM ***directory specified by PST_FILE_MASK.
set SCANPST_PATH="C:\Program Files (x86)\Microsoft Office\root\Office16\SCANPST.EXE"
set PST_FILE_MASK="D:\Users\josh\Documents\My Mail\*.pst"
REM *** CD into in the directory that contains the launched batch file...
echo CDing into "%~dp0"
pushd "%~dp0"
for %%i in (%PST_FILE_MASK%) do (
REM Add an N to the end of the following line of you don't want backup files
:loop
echo checking files %SCANPST_PATH% "%%i" No backup for repair
cscanpst.exe %SCANPST_PATH% "%%i" N
echo Finished checking files %SCANPST_PATH% "%%i"
if errorlevel 3 goto exit
if errorlevel 1 goto loop
:exit
ECHO %SCANPST_PATH% "%%i" File scanned clean!
)
:done
@echo Log:
@type cscanpst.log
@pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment