If you often store important information on your USB flash drives, it’s important for you to know how to get rid of a virus and save your files from being lost forever.
In this article:
How to Get Rid of a Virus on Your USB
Virus Removal Steps
Step 1: Plug the USB into a Computer
Plug in your USB and wait for the computer to register it. When the operating system displays a window asking what you want to do with the drive, click “Cancel” to close it.
Step 2: Run the Command Prompt
Click the “Start” button and then “Run” to launch the “Run” command box. Then type in “cmd” and hit “Enter” to start the Command Prompt. This will open a window with a black background and a “C:” next to a blinking cursor.
Step 3: Find the Drive in the Command Prompt
Click the “My Computer” button and then right click on the flash drive’s icon. Find out which drive letter is designated to the flash drive.
Then go back to the Command Prompt window and type in the letter of the flash drive along with a colon. If it was drive “E”, type in “E:”. Then press “Enter”.
Step 4: Find Out What the Virus is
Type “dir /w/a” in the Command Prompt and press “Enter”. This will open a list of files that are inside the flash drive.
Look for any unfamiliar or corrupted files in the flash drive. Most viruses will have names like “svchost.exe”, “Ravmon.exe”, “Autorun.inf”, and “Heap41a”. There are different types of viruses with different steps to remove them, but you can always try most basic way to remove it first.
Step 5: Disable the Infected Files
Type in “attrib -r-a-s-h” in the Command Prompt and then press “Enter”. This will disable all of the infected files, including all of the files attributed with:
- “read only”
Step 6: Delete the Files
Once disabled, you should delete all of the infected files. In the Command Prompt, type in “del samplefilename”. Substitute the samplefilename with the actual name of the infected file. Then press “Enter” and this will remove them from the flash drive. Close the Command Prompt.
Step 7: Scan the USB with an Anti-Virus
Open your anti-virus and use it to do a virus scan on the flash drive. This will initiate a thorough scan and it will show a report if there are any more infected files or viruses in the drive.
Step 8: Check the USB on Another Computer
Safely eject the flash drive and then plug into another computer. Repeat the first 2 steps using the Command Prompt to check if the virus is no longer there.
The Shortcut Virus
One of the most common types of USB viruses is the shortcut virus, and it comes in 2 forms:
- Computer virus: replaces the folders on your desktop and the file icons in your computer with shortcut icons that won’t lead you to the actual file.
- USB flash drive virus: takes all of your files and attributes them as “hidden” or places them in a hidden folder.
This USB flash drive virus will also produce an application file named “shortcut.exe”. If you open this application, it will release and activate the virus into the computer the flash drive is plugged into. The first set of instructions may not work for all shortcut viruses, but you can manually remove it.
How to manually remove a shortcut virus:
- Plug in the USB and right-click the Command Prompt and select “Run as Administrator”.
- Type in the USB’s drive letter and press “Enter”.
- Type “del *.lnk” and press “Enter”.
- Type “attrib -s -r -h *.* /s.d/l/” and press “Enter”.
- Open your flash drive normally and check if all of your files are normal again.
In case there are still infected files, copy your normal files onto the computer, then reformat the drive by typing “format /q/x driveletter:” in the Command Prompt. Replace the word driveletter with the designated drive letter. Then hit enter and return your files again afterward.
The Autorun Virus
The autorun virus is a common virus on flash drives that may easily go unnoticed. In most computers, after the flash drive is plugged in, the operating system will open a command window.
When a drive is infected, this window will appear as “autorun.inf” which almost looks harmless for people who don’t know it’s a virus. This command window houses the autorun virus.
This virus is automatically activated when the operating system opens the autorun.inf. However most operating systems today no longer automatically open the flash drives, which acts as a precaution against this virus.
How to remove an autorun virus:
- Open your flash drive.
- Delete the autorun.inf application.
- Restart the computer and then open the Command Prompt.
- Type the drive letter of the USB and press “Enter”.
- Type “attrib -r -h -s autorun.inf” and press “Enter”.
- Restart the computer.
Another way you can delete this virus is through your antivirus’ malware removal. Scan the flash drive using the antivirus and if a virus is detected, follow the program’s instructions on how to remove it.
More Tips for the Future
Tip #1: Back Up Your Files
You can often obtain a USB flash drive virus from the Internet or from sharing files to and from other computers without an antivirus. There are no programs that you can install on a flash drive to keep the files protected. The best thing you can do is to always keep a backup of your files on the computer or another flash drive.
Having a backup will also allow you to reformat your USB flash drive without worrying about losing your files. This is especially useful if you obtained a strong virus your antivirus can’t get rid of.
Tip #2: Only Have 1 Antivirus
If you have more than one antivirus program running on your computer, they will compete with each other over the virus. This is a bad thing because 3 things can happen:
- They will both consume resources and, depending on your system memory, it will leave both programs without sufficient power.
- They will compete over the virus even if it is already quarantined inside one of the programs. The other program will continue to detect it and attempt to take it out with its own virus removal programming.
- They will kill each other because there’s a chance that both programs will treat the other as a virus.
Knowing how to get rid of a virus depends a lot on what kind of virus is on your flash drive. Most of the time, it may be a harmless virus you can easily delete yourself. However, if you think your flash drive has a virus, don’t plug it into a computer without an antivirus. When it comes to your devices, it’s still better to be safe than sorry.
Do you have more questions on how to get rid of a virus on your USB flash drive? Mention them in the comments section below!