If you often store important information on your USB flash drives, it’s important 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 Devices
Virus Removal Steps
Step 1: Plug the USB into a Computer
Plug in your virus infected 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, 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, 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”.
Different types of viruses have different ways of removing them, but you can always try the most basic way to remove it first.
Corrupted Files Definition: Corrupted files are any files on a computer that used to work properly, but have become unopenable or inoperative.
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,” which 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, then plug into another computer. Repeat the first two 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 two 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.”
- Afterward, 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 to 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 get a USB flash drive virus from the Internet or from sharing files to and from other computers without an antivirus. There are no programs 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 persistent virus your antivirus can’t get rid of.
Tip #2: Only Have One Antivirus
If you have more than one antivirus program running on your computer, they’ll compete with each other over the virus. Here are four things that can happen in this scenario:
- They’ll both consume resources and, depending on your system memory, will leave both programs without sufficient power.
- Both antiviruses 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’ll kill each other because there’s a chance that both programs will treat the other as a virus.
- They can cause performance issues in your system. Due to the fact that they both consume computer resources, they can cause your computer to run slower.
You might think that having multiple anti-virus software working at once provides an added layer of protection, but you’re wrong. In fact, it will make your system run slower.
Instead, you should find the one software that has everything you need and stick with it. It’ll save you time and money while still protecting your computer.
Also, don’t accept the lure of free anti-virus software. The software may be free, but it might also not be providing the complete protection a paid anti-virus software can give you.
Tip #3: Be Vigilant While On The Internet
Nowadays, there are plenty of online scammers looking for vulnerable netizens they can attack. Once they get a hold of your weakness, they’ll try to infect your computer with all sorts of malware that retrieve sensitive information from you.
At that point, if your USB drive is plugged into your computer, it’s likely to get infected as well. Thus, you should always be wary of your online activity so you don’t get a virus on your drive.
Don’t click on random links online, nor should you download files from dubious websites. By staying vigilant when you browse online, you protect not only your computer but also your flash drive from the dangers of a USB virus.
Tip #4: Write Protect Your USB Drive
A lot of USB drives today have a switch that can help you protect your device from a USB virus.
When you turn on this switch, you write protect your USB drive. Write protecting a drive means that no data can be written on the drive.
Instead, the drive will be read-only, meaning you can only view files in the drive and not add any into it. This is one way on how to get rid of a virus on your drive.
Unfortunately, not all USB drives have a physical switch that write-protects them. With this type of drive, you can instead opt to install free applications into the drive that can make your USB read-only.
Tip #5: If All Else Fails, Format Your Drive For USB Virus Removal
Formatting your drive should be for worst case scenarios only. When you format your drive, what happens is you delete every file in your USB drive.
Of course, by every file, we mean including the hidden files that could be the virus in the drive. Due to the fact that it deletes every single file in the drive, you shouldn’t do this unless you’re desperate for a clean slate.
Don’t do this if you have any important files in the USB that you haven’t backed up yet or don’t want to lose. However, if you really can’t remove the virus no matter what and you don’t have any crucial files in the drive, then feel free to format the drive.
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!
- Preserving Your Digital Data Files | How To Back Up Digital Data
- How To Recover Permanently Deleted Files From A Flash Drive
- 11 Tips On Using Social Media Channels For Your Product Launch
Editor’s Note: This post was originally published on December 31, 2018, and has been updated for quality and relevancy.