Jump to content

Recommended Posts

Posted (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 by mrmattmc
  • 5 months later...
Posted

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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...