This works in XP
@echo off
:: BackupOutlookMailXP.cmd
setlocal ENABLEEXTENSIONS
:: Backups go here
set envBackupLoc=F:\Outlook Backup
:: Default location of email
set envMail=%USERPROFILE%\Local settings\Application data\Microsoft\Outlook
:: Use the Quick Launch shortcut to restart Outlook
set envQL=%USERPROFILE%\Application Data\Microsoft\Internet Explorer\Quick
Launch\launch microsoft outlook.lnk
:: Kill running instances of Outlook
%WINDIR%\System32\taskkill.exe /F /IM OUTLOOK.EXE > nul 2>&1
:: in xp home and lower use (tskill uses the process name not an image name)
:: %WINDIR%\System32\tskill.exe outlook > nul 2>&1
:: Sleep (probably not really needed)
ping -n 11 localhost > nul 2>&1
:: Do the backup
xcopy "%envMail%" "%envBackupLoc%" /c /e /i /s /y
:: Restart Outlook
"%envQL%"
endlocal
Or you can call this little VBS script to kill Outlook in just about any OS
ver that includes WMI.
'KillOutlook.vbs
set wmi = getobject("winmgmts:")
wql = "select * from Win32_Process " & " where name='outlook.exe'"
set results = wmi.execquery(wql)
for each app in results
app.terminate
next
wscript.sleep 10000