Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Copy command in BTM file fails occasionally

I have a simple BTM file to copy two Outlook '.ost' files to a backup folder - an excerpt of the file is shown below. Sometimes it runs fine, at other times, it only copies one of the two '.ost' files. The error log only show that the command was aborted with no explanation. Based on another user's post, I included the force close option in Outlook in case it is still running. I also included a delay statement in case some other Outlook process had not finished. I increased the delay from 3 seconds to 6 seconds, but it still fails on occasion. If I run the BTM file manually, it always works. If it makes any difference, the '.ost' file that fails is an icloud email address. Any suggestions would be appreciated.

...

TASKEND /F OUTLOOK

DELAY 6

Set _myvar1=%%@dow[%_date]
Set _myvar2=%%@dowi[%_date]

Copy C:\Users\Robert\AppData\Local\Microsoft\Outlook\*.ost F:\OST_Backups\%_myvar2%-%_myvar1% /Y

@Echo off

Date /F0 /T
Time /T

Quit



Here is an example of the command log created when it fails [actual email address omitted for privacy reasons]

TASKEND /F OUTLOOK

DELAY 6

Set _myvar1=%@dow[01/28/22]
Set _myvar2=%@dowi[01/28/22]

Copy C:\Users\Robert\AppData\Local\Microsoft\Outlook\*.ost F:\OST_Backups\6-Fri /Y

C:\Users\Robert\AppData\Local\Microsoft\Outlook\[email address 1] - Default(2).ost => F:\OST_Backups\6-Fri\[email address 1] - Default(2).ost
C:\Users\Robert\AppData\Local\Microsoft\Outlook\[email address 2] - Default(2).ost => F:\OST_Backups\6-Fri\[email address 2] -
Default(2).ost

TCC: (Sys) D:\documents\computer & electronics\Backup_OST1.btm [16] The request was aborted.
1 file copied 1 failed


Fri Jan 28, 2022
5:55:08p

D:\documents\computer & electronics >
 
Are you sure DELAY 6 is enough? I get that error trying to copy .OST files when OUTLOOK is running and not when OUTLOOK is stopped. You might try

Code:
do while isapp outlook.exe (delay 1)

And there was a recent report of "The request was aborted." errors (when coping from \\WSL$). Those errors went away between TCC v26 and v27.
 
COPY also has "/WAIT=n"
That's entirely unrelated functionality.

You can run a loop to test if image is still running, something like
Code:
taskkill /IM "outlook.exe"; while test $( tasklist /FI "ImageName EQ outlook.exe" /FO CSV | wc -l ) -gt 1; do sleep 10; done
 
What's the point of backing up an OST file? That's an offline cache copy of a server-side mailbox. If the OST is ever deleted, Outlook will just re-cache your data and make a new OST file.
 
This is a very interesting post because it relates to an issue that I have seen. I, too, have a batch file that backs up my Outlook PST (not OST) files to other computers on my home network. When I run this file, I *sometimes* get the following error message:

TCC: C:\Users\Jesse\AppData\Local\Microsoft\Outlook\toall.btm [329] Unknown command "&"

The interesting thing about this error is that there is no & in the entire batch file! Line 329 is the end of a multiline for loop that steps through all my "ready" disks. Most times, if I simply run the batch file a second time, it then works just fine.

This situation has existed for me for years. I have tried to use delays, too, to no avail. It's not a huge deal, because as I said i just rerun the batch file and most times all is well. I have never posted about this before, but since this thread is about a similar issue, I'm posting about it now.
 
I think that's how multiline FOR commands are handled internally; they're concateneted and separated by ampersands (and maybe otherwise massaged). With that in mind, Jesse, maybe you could figure out why it's choking and fix it (?).
 

Similar threads

Replies
7
Views
2K
Back
Top