How to Remove Virus from Pendrive: Using CMD (Without Losing Data)

Get 3 months free
Save 63%
Get Deal!
Save 82%
Get Deal!
Save 49%
Get Deal!

If you have a pendrive with infectious viruses and you want to remove them without losing your data, this article is for you.

There are many ways to remove viruses from pendrives, one of which is using a CMD. However, this method may not work with all types of virus.

How to Remove Virus from Pendrive: Using CMD (Without Losing Data)

Pen drives, as we all know, are quite useful when viewed from the standpoint of mobility.

A virus in a pen drive may be caused by just two sorts of problems.

The first is referred to as a shortcut virus, while the second is referred to as an autorun virus. When it comes to viruses, pen drives are one of the most venerable gadgets.

In this post, we’ll show you how to remove any form of virus from your pen drive using anti-malware software and a few instructions that you’ll have to key in manually.

You’ll also discover how Windows takes precautions to safeguard your computer from the autorun malware.

Part 1: Virus eradication in a hurry

What exactly is a shortcut virus?

Overall, there are two types of this virus. The first one attempts to replace the file and folder icons on the desktop with its own shortcut icon.

This is the most prevalent virus that you may encounter on your pen drive.

If you look at the bottom half of the symbol, you’ll see an arrow on it.

When it comes to the other virus, this is a form of virus that will place the files you’re seeking for in a hidden folder and will do so using a program named shortcut.exe.

When you attempt to access a file on your pen drive, you are causing the virus to activate and propagate throughout your computer.

Using antivirus software to get rid of the shortcut virus:

If you want to get rid of the virus, you’ll need to seek for the nasty bug and use antivirus to get rid of it.

To do this and learn how to delete a shortcut from Pendrive, you must first:

  • Select My computer from the Start menu.
  • Then right-click on the choices that appear above their names, such as detachable drive.
  • Then you must choose Scan for Viruses.

If you don’t have any antivirus software installed on your computer, you may utilize the Windows Defender option.

You can turn on Windows Defender by going to the control panel and picking the windows defender option, then turning it on. However, if your machine does not have an antivirus installed, Windows Defender will activate automatically.

  • When the scan is finished, the antivirus will notify you whether the malware is present on your pen drives.
  • The antivirus will attempt to delete the infection from your pen drive automatically, but if it does not, it will first ask for your consent.

Also see:

6 Ways to Resolve the Error “Windows License Will Expire Soon”

9 Ways to Resolve Error Code 0x8024a105 in Windows 10 Update

No Audio Output Device is Installed may be fixed in nine different ways.

Part 2: Getting Rid of the Autorun Virus

What is the autorun virus, and how does it work?

You will notice that the pen drive opens automatically whenever you attempt to insert it into your computer.

If the virus infects the pen drive you own, the autorun virus will be started when you open the pen drive.

The good news is that the pen drive does not open automatically in the latest Windows versions.

This implies that unless you open the pen drive manually, the autorun virus will not be started.

Using CMD, remove the Autorun Virus:

If you wish to remove the autorun virus from your pen drive, you must first delete the malware and then restart your computer.

These are the actions you must take —

  • Click the Start button, then type Run into the search box.
  • You must then type “CMD” and then press enter.
  • After that, a window named Command Prompt will open on your screen. You must input the letters linked with the Pendrive that you possess and then click enter.
  • Then type “attrib -r -h -s autorun.inf” into the command prompt. After that, hit the enter button.
  • Then type “del autorun.inf” into the command prompt. Then, on the enter tab, hit the enter key.
  • After you’ve completed this operation, you’ll need to restart your computer, and you’re good to go.
  • You will see that the infection has been eradicated when your computer resumes.


So those were the ways for removing the shortcut virus from the pen drive as well as the autorun virus. If you have a different technique, please share it in the comments section below.

I hope you found this post useful, and if you have any suggestions, please leave them in the comments section below.

The “how to remove virus from hard disk without formatting” is a process that has been used for many years. This process can be done using the “CMD” command prompt.

Frequently Asked Questions

How recover data from pendrive with virus?

A: Unfortunately, a virus can make your hard drive unreadable even when it seems to be working (i.e., you see the files on your computer). One of the most common ways to recover data from this situation is by using an external storage device like a USB thumbdrive that has not been infected with malicious software.

How can I delete virus using CMD?

A: To delete virus using CMD, you need to use an anti-virus scanning software and then search for files that are infected.

How can I remove shortcut virus from my flash drive permanently?

A: This is a difficult question to answer. You might find something online that says it can help remove the shortcut virus from your flash drive, but I cannot provide any guidance on this issue.

Related Tags

  • shortcut virus remover
  • how to fix shortcut files in usb using cmd
  • how to remove cricket score virus from pendrive
  • how to delete lnk files using cmd
  • how to remove virus from external hard drive
Vaibhav is a VPN expert with a passion for online security and privacy. He helps individuals and businesses protect their sensitive information and navigate the complex world of VPNs.