@ECHO OFF :: Check Windows version IF NOT "%OS%"=="Windows_NT" GOTO Syntax IF "%OS%"=="Windows_NT" SETLOCAL VER | FIND "Windows NT" >NUL && GOTO Syntax :: Check command line arguments -- none required IF NOT "%~1"=="" GOTO Syntax :: Check if DEVCON.EXE is available and if not, prompt for download SET DevconAvailable= SET Download= DEVCON.EXE /? >NUL 2>&1 IF ERRORLEVEL 1 ( SET DevconAvailable=No ECHO This batch file requires Microsoft's DEVCON untility. SET /P Download=Do you want to download it now? [y/N] ) :: Start download if requested IF /I "%Download%"=="Y" ( START "DevCon" "http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272" ECHO. ECHO Install the downloaded file and make sure DEVCON.EXE is in the PATH. ECHO Then try again. ) :: Abort if DEVCON.EXE is not available yet IF "%DevconAvailable%"=="No" GOTO End :: List and remove all USB devices >> RenewUSB.dat ECHO.%Date%, %Time% DEVCON FindAll =USB | FIND ":" >> RenewUSB.dat FOR /F "tokens=1 delims=: " %%A IN ('DEVCON FindAll ^=USB ^| FIND ":"') DO DEVCON Remove "@%%A" DEVCON FindAll USB* | FIND ":" >> RenewUSB.dat FOR /F "tokens=1 delims=: " %%A IN ('DEVCON FindAll USB* ^| FIND ":"') DO DEVCON Remove "@%%A" :: Rescan for new hardware DEVCON ReScan :: Done ENDLOCAL GOTO End :Syntax ECHO. ECHO RenewUSB.bat, Version 1.00 for Windows 2000 / XP ECHO Use DEVCON to remove all USB devices and then scan for new devices ECHO. ECHO Usage: RENEWUSB ECHO. ECHO Notes: [1] This batch file requires Microsoft's DEVCON.EXE, available at ECHO http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272 ECHO You will be prompted for download if it isn't found. ECHO [2] I tested this batch file on my own PC running Windows 2000 Pro SP4. ECHO However, I cannot guarantee flawless operation on any other PC. ECHO Use this batch file entirely at your own risk. Make sure you have ECHO a recent full backup available in case something might go wrong. ECHO [3] Before removal each USB device is logged in RENEWUSB.DAT. ECHO. ECHO Written by Rob van der Woude ECHO http://www.robvanderwoude.com :End