-1

How can I clean a USB flash drive from infections safely without losing files/documents inside?

When I connect USB drives, there are shortcuts, exe files and hidden files, so I want to make un-hidden, cleaned from viruses and safe docs and files too.

NoMAD
  • 49
  • 1
  • 1
  • 11
  • Most security software supports scanning a flash drive. Any detectable infections will be removed. The only other way would be to backup the files and documents, format the drive, the restore the files and documents from the backup. – Ramhound Aug 19 '14 at 14:11
  • 1
    Get an ISO of any decent Linux distro, mount the USB and DD the sh*t out of it. No virus will resist. On a second read, you have data on your USB, so first copy/paste the useful data to another USB before dd'ing – Con7e Aug 19 '14 at 14:21
  • Related: [Safely opening a suspect USB Drive](/q/167878/150988), [How can I browse an untrusted USB flash drive safely?](/q/983709/150988), [Is there any way to safely examine the contents of a USB memory stick?](//security.stackexchange.com/q/103088/34757), [What is the danger of inserting and browsing an untrusted USB drive?](/q/709275/150988), [How can a flash drive spread a virus?](/q/93939/150988), [How can USB sticks be dangerous?](//security.stackexchange.com/q/102873/34757),  and more. – Scott - Слава Україні May 06 '17 at 22:04

1 Answers1

-1

Here is handy batch file I wrote to rid USB drives of common infections. Launch the command prompt as administrator, navigate to the root of the USB drive and copy the batch file there. And run it.

@echo off
color 7c
echo .
echo .
echo .
echo Cleaning Drive...............
echo .
echo .
echo 1. Deleting autorun files...........
del /a /f "autorun"
del /a /f "autorun.inf"
echo .
echo .
echo 2. Removing New Folder.exe virus..........
del /a /s "* .exe"
del /a /s regsvr.exe
echo .
echo .
echo 3. Removing Screen Saver virus........
del /a /s "*.scr"
echo .
echo .
echo 4. Removing Recycler virus (Press Y if asked)..........
del /a /s /f Recycler

echo .
echo .
echo 5. Removing Unnecessary Shortcuts and desktop_1.ini files..........
del /a  /f /s "*.lnk"
del /a /s /f "Desktop_1.ini"
echo .
echo .
echo 6. Un-hiding original folders.......
attrib /s /d * -h -s
echo .
echo ======== Drive cleaned Successfully=========
echo .
echo .
echo .
choice /T 3 /D y /N /M "The disinfection batch will auto-terminate in 3 seconds"

This is not a fool-proof solution and I still recommend scanning the drive with a good antivirus.

tumchaaditya
  • 3,752
  • 5
  • 39
  • 57
  • PS: This batch file is partly sourced from internet and I don't claim all the credit for this. I made a few amendments and additions. – tumchaaditya Aug 19 '14 at 14:22
  • Thanks for answer to my question friend. at first i have to navigate to my root on CMD for example: H: and should paste ur given batch file into there all right? – NoMAD Aug 19 '14 at 14:49
  • Don't paste it there. First create a batch file by pasting my code above using notepad or something, copy it over to root of USB drive and then run the batch file from command prompt. – tumchaaditya Aug 19 '14 at 14:50