mrmattmc Posted March 8, 2014 Posted March 8, 2014 (edited) Sorry if I'm posting this in the wrong spot. But I have a question about the duckywait bat file. It does a good job of detecting drive insertion. I have been toying around with trying to reverse the logic to detect drive removal. This would be nice to have to have a few safety net files handy to run in case the process get interrupted and you have to jerk the drive out quick like. Copy some cleanup routines to temp, trigger them when the drive is removed.. as you race neo like through the building dodging mr smith. It acts as though diskpart is not updating the status of the attached drives. The routine will repeat, drive still attached. I have even ran the command to list volumes in diskpart while the bat file is running and it shows no DUCKY! Yet the script still fails to recognize drive removal. I have tried some variations to no avail so I'll post what seems like it should work. Here is what I have. EDIT Got it to work using SETLOCAL and ENDLOCAL see the RED highlights. @echo off setlocal :while1 for /f "tokens=3 delims= " %%A in ('echo list volume ^| diskpart ^| findstr "DUCKY"') do (set DUCKYdrive=%%A:) if [%DUCKYdrive%] EQU [] ( echo waiting on jump drive... timeout /t 3 goto :while1 ) else ( echo Jump Drive Found ! pause endlocal goto :impatient ) :impatient setlocal for /f "tokens=3 delims= " %%A in ('echo list volume ^| diskpart ^| findstr "DUCKY"') do (set DUCKYdrive=%%A:) if [%DUCKYdrive%] EQU [] ( echo Jump Drive Removed ! timeout /t 20 goto :end ) else ( echo Jump Drive Still in... timeout /t 3 endlocal goto :impatient ) :end echo goodbye exit Edited March 8, 2014 by mrmattmc Quote
PXgamer Posted September 2, 2014 Posted September 2, 2014 Hi all, This scripts sounds great, I am waiting for the Duckys to be back in stock. But the .bat script works fine. Sadly, when I run it, it only copies the files in the main directory of Documents. It will not copy any folders, or any files in sub-folders. Is it possible to copy all the folders located in documents too? Thanks in advance. :) - PXgamer Quote
Broti Posted September 2, 2014 Posted September 2, 2014 Hi, I've got a suggestion for the DuckSlurp batch file. instead of using xcopy you could also use robocopy. robocopy /B This parameter sets robocopy in backup-mode, thus bypassing any ACL rules. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.