How to Remove Virus from Pendrive: Easy and Advanced Methods
Troubled by a virus-infected pendrive and worried about your precious data? Let’s show you how to remove virus from pendrive with easy to advanced methods.
But if your storage device is infected, the worst and last option would be to format it.
Now, what if we said that you can remove viruses without losing data!
So, follow along with us on how to remove virus from pendrive using easy-to-follow methods.
Use Command Prompt to Remove Virus on Windows
The Command Prompt (cmd) can be a powerful tool for removing viruses from your pendrive. This can be done without losing our data.
Steps to Use Command Prompt
Step 1: Insert your infected pendrive into your computer. Make sure it is properly connected to the USB slot.
Step 2: Open the Command Prompt as an administrator or Open it.
Step 3: Click on the Start button and select “Command Prompt (Admin)”).
Step 4: Type the drive letter associated with your pendrive (e.g., “D:”) and press Enter.
Step 5: Type “attrib -s -r -h /s /d: D:\ *.* ” and press Enter. This command will reset the attributes of all files and folders on your pendrive.
What’s Next
- The Command Prompt will process the command and initiate the attribute changes specified in the command.
- It will run recursively through all files and folders on the “D:” drive, which is your pendrive, to remove the “System,” “Read-only,” and “Hidden” attributes from all files and folders.
- As the command executes, it will display a list of all the files and folders on the pendrive, showing the attributes as they are modified.
- Once the command completes the process, all files and folders on the pendrive should have their attributes reset, making them visible, allowing modifications, and removing the “system” attribute.
- You should see a message in the Command Prompt indicating the completion of the command without errors.
It’s important to note that this command is used to reset file and folder attributes, and it does not guarantee the removal of viruses or malware from the pendrive.
You should follow up with a thorough antivirus scan to ensure that the device is free from any malicious software. (We will catch up on this a little later in the blog!)
Explanation of the Command
Abbreviation | Description |
---|---|
Attrib | An MS-DOS command that helps modify file and folder properties. |
-h | Shows all hidden folders. |
-r | Recreates the files on your disk. |
-s | Removes the file link on the system. |
/s | Directs the command to loop through all files and folders on the entire device, making it recursive. |
/d | Directs the command to apply to folders as well, extending the command’s effect to both files and folders. |
*.* | Signifies that it encompasses all file and folder names, treating them as matches for the command. |
When this CMD prompt may not work…
Some commands, especially those that alter file attributes, require administrator or elevated privileges to execute. The command may not be recognised if you do not have the necessary permissions.
Best-suited Cyber Security courses for you
Learn Cyber Security with these high-rated online courses
Create a Batch File on Notepad on Windows
Creating a batch file to remove viruses from a pendrive is possible. But, please note that this method is not as effective or reliable as using dedicated antivirus software.
Step 1: Create a New Text Document
- Right-click in the folder where your batch file will be saved.
- Choose “New” and then “Text Document.”
Step 2: Edit the Batch File
- Rename the text document to have a “.bat” file extension. For example, you can name it “RemoveVirus.bat.”
- Right-click on the batch file and choose “Edit” to open it in a text editor.
Step 3: Write Batch Commands
You can use command-line utilities like the inbuilt Windows Defender to scan and potentially remove viruses. This antivirus programme can be run from the command prompt or terminal, allowing users to perform scans and virus removal tasks via the command line.
Use this command
@echo off
echo Scanning for viruses on your pendrive…
“C:\Path\To\Antivirus\Program.exe” /scan /remove D:\
echo Virus removal complete.
pause
Replace “C:\Path\To\Antivirus\Program.exe” with the actual path to your antivirus program. The “/scan” and “/remove” flags are specific to the antivirus software you’re using. “D:” is the drive letter of your pendrive.
Step 4: Save and Run the Batch File
- Save the batch file.
- Double-click on the batch file to run it. It will execute the commands you’ve written.
Things to Consider for this Pendrive Virus Removal Method
- The effectiveness of the batch file depends on the antivirus software used and its command-line capabilities.
- It may not detect or remove all viruses, especially new or complex malware.
- Incorrectly configured batch files could delete important files or cause other issues.
Remove From Windows Registry
If you are an advanced user who has learned from operating system courses, you may know that Windows Registry is used in the context of virus removal. This is due to the reason that some viruses and malware add entries to the Registry to achieve persistence or maintain control over the infected system.
In this case, follow the below steps.
Step 1: Simultaneously press the Win + R keys to open the Run dialog.
Step 2: Type “regedit” and hit Enter to launch the Registry Editor.
Step 3: Navigate to Computer > HKEY_CURRENT_USER > SOFTWARE > Microsoft > Windows > CurrentVersion > Run.
Step 4: Identify any suspicious keys and right-click on them, then select “Delete.”
Use Antivirus Software
This is the easiest thing to do. After inserting the infected drive, right-click on the icon on the bottom right-hand side of the toolbar.
If you have an antivirus software, it will scan it and show a notification. You can then delete and still have the files.
Format the USB Drive
When nothing else works, you should format the drive. You will lose data, for sure. But this is one the most effective ways to stop the virus from spreading to your other system.
Ways to Scan Viruses on Your Pendrive
Running Windows Defender through Command Prompt
To run Windows Defender through Command Prompt, you may take the following steps.
Quick Scan: To perform a quick scan, type “MpCmdRun.exe -Scan -ScanType 1” and press Enter.
Full Scan: To perform a full scan, type: “MpCmdRun.exe -Scan -ScanType 2” and press Enter
Command Prompt is a powerful tool within the Windows operating system. You can even change directory using CMD easily.
Types of USB Virus
Type of USB Virus | Capabilities |
---|---|
Autorun Worm | Spreads through the Autorun.inf file. May replicate and spread to other connected devices. |
File Infector | Infects executable files on the pendrive. May corrupt or modify files, making them unusable. |
Trojans | Can disguise as legitimate files. May steal data, provide unauthorised access, or cause damage. |
Worms | Self-replicating and can spread to connected devices. May degrade system performance. |
Ransomware | Encrypts files and demands a ransom for decryption. Can render files inaccessible. |
Shortcut Virus | Creates shortcuts to files, hiding the original files. May spread to connected devices. |
Signs that Your USB Drive is Infected with Virus
Signs of Virus Infection in Pendrive | Description |
---|---|
Strange File and Folder Names or Extensions | If you notice odd file names or unfamiliar extensions on your pendrive, it’s a strong indicator that your device might be infected. |
Unexpected Behavior of Files or Applications | Pendrive viruses can make your files act erratically. You may find that files won’t open, or applications crash unexpectedly. |
Slow Performance or Frequent Freezing of the Pendrive | An infected pendrive can suffer from sluggish performance, making it difficult to access or transfer data smoothly. Frequent freezing is a telltale sign of a virus at work. |
Anti-virus Software Alerts or Warnings | Your antivirus software may detect and warn you about the presence of a virus on your pendrive. Never ignore these alerts; they’re your first line of defense. |
If you are interested in data protection topics and feel like exploring them in your professional domain, choose from the list of cybersecurity courses!
Aquib is a seasoned wordsmith, having penned countless blogs for Indian and international brands. These days, he's all about digital marketing and core management subjects - not to mention his unwavering commitment ... Read Full Bio