autorun.inf & removedrive.exe

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mr5o1
Posts: 1
Joined: 11 Mar 2009 19:58

autorun.inf & removedrive.exe

#1 Post by Mr5o1 » 11 Mar 2009 20:17

hi all, and tia..

I have a batch on my SOHO server which performs daily backups to a local drive using 7zip, and purges old backups.

I have an external drive which I'd like to simply plug in, have it sync (robocopy) with the backups folder, and then unmount itself.

removedrive.exe does work for this drive.. but I'm having trouble with autorun.inf remaining an "open handle". Any ideas?

essentially:
-autorun.inf runs sync.bat
-sync.bat syncs the two folders, then calls removedrive.exe
-removedrive.exe fails due to an open handle

autorun.inf:

Code: Select all

[autorun]
open=h:\backup\process\sync.bat


h:\backup\process\sync.bat:

Code: Select all

:: -------------------------------------------------------------------
:: relevant variables:

set syncsrc=h:\backup\archive
set syncdes=f:\archive
set syncdesid=drive1
set synclog=h:\backup\process\logs\sync.log
path %path%;H:\backup\process\dosutils;


:: -------------------------------------------------------------------

:: create log
@echo ----------------------------------------------------------------- > %synclog%
@echo [%date%][%time%] External drive [%syncdesid%] inserted. >> %synclog%
@echo [%date%][%time%] Commencing Sync >> %synclog%
@echo [%date%][%time%] Pre sync source: >> %synclog%
@dir %syncsrc% >> %synclog%
@echo [%date%][%time%] Pre sync dest: >> %synclog%
@dir %syncdes% >> %synclog%

robocopy %syncsrc% %syncdes% *.7z /NP /MIR >> %synclog%

bmail.exe <removed personal email info> -a "%date% purge log" -m %synclog%

removedrive f: -b -l


:: tidy up
::del %synclog%


also - a seperate issue, xp autoplay scans the drive (takes ages: large drive) and -then- asks me whether to run autorun.inf, or open folder to view files or whatever.. is there any way around this autoplay behaviour? (so it will just run autorun.inf straight away.)


Thanks for taking the time!!

Acris
Posts: 5
Joined: 01 Jan 2009 11:44

#2 Post by Acris » 12 Mar 2009 01:48

Hi
kill process robocopy ?

i use usbeject
USBEject.exe /SHOWEJECT /REMOVELETTER %usb%

Post Reply