On this page, we provide four practical methods to help you remove viruses and recover deleted or lost files with powerful data recovery software tools. If you find yourself in this predicament, follow the solutions outlined here to cleanse your system of viruses and restore your files:

Please provide the English content you want to translate, and I'll promptly translate it into Chinese for you.

Workable Solutions Step-by-Step Troubleshooting Guide
Effective Solutions Stepwise Troubleshooting
Solution 1. Remove Virus Using CMD Run Command Prompt as an administrator or use M Tool > Type attrib -s -h -r /s /d *.* to clear the virus...Full Steps
Solution 2. Run Antivirus Software Run your installed antivirus software and perform a cleanup if a virus is detected...Full Steps
Solution 3. Run Windows Defender Go to Settings > "Update & Security" > "Windows Security" > "Virus & threat protection"...Full Steps
Solution 4. Format Infected Device If a hard drive partition or external storage device is infected, formatting might help...Full Steps

What damage can they do?

What Damage Can a Computer Virus Do

We all hate computer viruses, right? No question about it. But do you know how they actually mess with your computer? Well, there are lots of different types, and they behave in different ways, but, basically, a computer virus is a program that makes your computer do things you don't want it to. Some are designed to destroy your computer, delete important files, track what you do online, or give hackers access to your personal information. They're just plain nasty. Ransomware like Locky and CryptoLocker delete and encrypt your files, even changing the file extension to .locky or .encrypted. Others hide your files so you can't find them, and seem impossible to un-hide.

How to Recover Files Deleted/Hidden by a Virus

Though CMD commands can help remove virus, they cannot restore files that have been damaged or lost due to virus infection. A Data Recovery Wizard tool can recover lost data in various severe situations.

Follow the guide below to learn the three-step file recovery method.

How to use the Data Recovery Wizard tool to restore lost data? How to use the Data Recovery Wizard tool to restore lost data?
 

Step 1. Select the virus-infected disk to scan

Run an antivirus file recovery software on your Windows PC. Select the disk that was infected by the virus to scan for lost or hidden files. Note that:

    • If the HDD is infected and files are hidden or deleted because of a virus, it's recommended to install the software on a different partition or an external USB drive to avoid overwriting data. • If the infected device is an external hard drive, USB flash drive, or memory card, it's fine to install the program on the local disk of your computer.
Select the location to scan

Step 2: Review all scan results

The "Data Recovery Wizard" tool will immediately start scanning the virus-infected hard drive to find deleted or hidden files. To quickly locate the file you need, use the "Filter" or "Group by Type" feature to display only images, videos, documents, emails, and so on.

Recover deleted or lost files

Step 3: Preview and recover the deleted/hidden files

Once the scan is finished, you can preview the files that were found. Select the ones you want, then click “Recover.” Save the recovered files to a safe location on your computer or storage device, not the original location where they were lost.

Recover files from virus attack

Indeed, once you detect a virus, you would want to get rid of it. Among many options, several users try deleting a virus using CMD.

Why can you delete viruses using CMD?

Actually, using the Command Prompt doesn't directly scan and remove viruses from your computer or external storage device. It helps you achieve the goal of virus removal by showing hidden viruses on disk partitions or drives. You can then delete suspicious files. Since viruses always hide themselves, you need to reveal them so that you can delete the virus files. How do you display potential hidden virus files using CMD? All you need is the attrib command.

The `attrib` command is a Command Prompt utility used to view, set, or remove the attributes of a file or folder at a specified location. By un-hiding the virus's "hidden" attribute, you'll be able to see it within your folders. You'll then know where to find and delete it.

How to Remove Viruses Using CMD In the Windows operating system, the Command Prompt (CMD) can serve as a tool to help remove certain viruses, although it's not always effective and requires some computer literacy. Here's a basic step-by-step guide: 1. **Start Your Computer in Safe Mode**: Viruses might prevent you from performing certain actions in normal startup mode. Restart your computer and repeatedly press F8 during startup to access the "Advanced Boot Options." From there, select "Safe Mode." 2. **Open Command Prompt**: In Safe Mode, click the "Start" button, then type "cmd" into the search box. Look for "Command Prompt" in the search results, right-click it, and choose "Run as administrator." 3. **Run a Scanning Command**: Within the CMD window, use the `scannow` command to scan system files. Type `sfc /scannow` and hit Enter. This command will check for and repair any errors or damage in system files. 4. **Delete Malicious Files**: If you know the specific location of the virus or malware file, you can use the `del` command to delete it. For instance, if the file is located at C:\folder\malware.exe, enter `del C:\folder\malware.exe` in the CMD and press Enter. 5. **Restart Your Computer**: After completing these steps, restart your computer for the changes to take effect. 6. **Install an Antivirus Software**: While CMD can assist with some viruses, the best defense is a reliable antivirus software. Install and run a full system scan in Normal Mode. Please note that this process doesn't guarantee removal of all types of viruses, especially sophisticated malware, which may require specialized security tools or technical support. If unsure or encountering difficulties, it's advisable to seek assistance from a professional computer technician.

Now, follow the steps below to remove the virus from your computer or storage device using CMD:

Step 1: Type cmd in the search bar, right-click on "Command Prompt," and select "Run as administrator."

Step 2. Type F: and press 'Enter' key. (Replace "F" with the letter designating the infected partition or drive.)

Step 3: Type attrib -s -h -r /s /d *.* and press "Enter."

Step 4. Type dir, and press "Enter". You will now see all the files on that drive. (The dir command displays a list of files and subdirectories in a directory.)

The name of the virus may contain the word "autorun," and the file extension will be ".inf." If you find such a suspicious file, type del autorun.inf to remove the virus.

Remove virus using cmd in Windows 10

Here are the basic attributes of the `attrib` command:

R - denotes the "Read-only" attribute of a file or folder, meaning it cannot be written to or executed.
H - stands for the "Hidden" attribute.
A - represents the "Archive" attribute, used to prepare files for archiving.
S - the "System" attribute, which changes selected files or folders from user files to system files.
I - indicates the "Not Content Indexed" attribute.

"Attrib" Syntax:

ATTRIB [+attribute | -attribute] [filename[and path] [/S [/D]]

In the command above, let's examine what each of the parameters and flags mean:

'+ / -': Enables or disables the specified attribute.
'attribute': As mentioned above.
: Searches the entire path, including subfolders.
'/D': Includes any folder that contains a process.
< strong>'pathname': The path to the target file or folder.

Here is the correct syntax order for the attrib command:

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]]

Warning
Be very careful when using the Command Prompt. Incorrect use of cmd can cause damage to your system. Therefore, it is recommended to perform data recovery in advance before proceeding with the CMD method.

If you receive a “Permission denied” message, you should:

    Make sure you're running the Command Prompt as an administrator. Ensure that the file/folder is not in use. Check the permissions of the current user account and make sure you have full control over the file/folder (right-click on the file/folder/partition, then select "Properties" and navigate to the "Security" tab). Scan for file system errors using the CHKDSK command (open the Command Prompt and type chkdsk /f [drive letter]:).

Manual execution at the command prompt is more suitable for computer experts, as incorrect commands can do more harm than good. For safety and ease of use, we highly recommend trying an automated command-line alternative, such as CleanGenius. This utility allows you to check and fix file system errors, enable or disable write protection, and update your system with a single click, without the need to type complex command lines.

To reveal hidden files using this one-click repair tool, simply follow these easy steps.

Step 1: Download the free CleanGenius tool.

Step 2: Launch CleanGenius, and then choose “Optimize” from the left panel. Next, click “File Display” on the right.

Show Hidden Files - Step 2

Step 3: Select the hard drive and click 'Execute'.

File Repair - Step 2

Step 4: After you finish the Folder Options setup, click on this link to view the hidden files.

Show Hidden Files - Step 3

Three other ways to beat the virus

Aside from using CMD, you can remove viruses from your computer or storage device using antivirus software, Windows Defender, or by formatting the storage device.

Method 1: Run an Antivirus Program

Almost every computer has antivirus software installed. Running this when you suspect an infection can be helpful. We recommend using TotalAV, a powerful antivirus and security program that can quickly scan your system and protect your computer.

Please provide the English content you want to translate, and I'll translate it into Chinese for you.

TOTALAVTOTALAV

TotalAV is an award-winning antivirus and security software that provides real-time protection against viruses, malware, and online threats.

Get Protection Now

Activate Antivirus Protection

Method 2: Run Windows Defender Antivirus

Windows Defender Antivirus is the built-in antivirus protection for Windows 10 and 11. It protects your computer and connected devices from viruses, malware, and spyware. If you don't have a third-party antivirus, it's wise to use the built-in tool.

Step 1: Go to Settings > Update & Security > Windows Security.

Step 2. Click on Virus and threat protection.

Step 3: In the 'Threat History' tab, click on 'Scan Now' to scan for viruses on your computer.

Run Windows Defender to remove viruses

Method 3: Format the Infected Device

Formatting refers to deleting the existing files on a selected partition or drive. This will, of course, get rid of the virus. However, since formatting a partition/drive results in data loss, make sure there are no important files stored on the device.

How can I protect myself from viruses or malware?

In addition to knowing how to deal with a virus attack, you should also know how to protect your computer or external storage device from getting infected in the first place. To better safeguard your computer or USB drive, here are some antivirus tips you can follow:

Install professional antivirus software on your computer and keep it up to date. Be cautious about the sources of programs you intend to install. Avoid visiting suspicious websites; think twice before clicking. Ensure your internet connection is secure. Additionally, it's recommended to back up your files regularly using free backup software to prevent data loss in case of a virus infection.

Bottom line

Using CMD to delete a virus is an indirect method, but it can work sometimes. If the "attrib" command doesn't work, try the other three methods to remove the malicious file. Besides, a virus attack often comes with data loss. In this case, you should use a hard drive recovery tool, like Data Recovery Software, as soon as possible to rescue your lost files.

Frequently Asked Questions on Using CMD to Remove Viruses (UTF-8 Encoding)

Do you have more questions about using CMD to remove viruses? Keep reading, and you'll learn more.

How do I remove the Shortcut Virus?

We'll recommend five methods to help you get rid of the Shortcut virus:

    1. Remove Shortcut Virus Using CMD 2. Create a BAT File to Remove the Virus 3. Remove Shortcut Virus with Antivirus Tools 4. Eliminate the Shortcut Virus from the Source Computer 5. Delete Suspected Registry Keys

How do I remove hidden viruses from my computer?

You can use built-in Windows tools to remove hidden viruses:

    1. Open Security Settings on Windows. 2. Select "Virus & threat protection," then click on "Scan options." 3. Choose "Windows Defender Offline Scan." 4. Review the results after the scan completes.

How can I tell if my computer has hidden viruses?

There are signs that your computer may have a hidden virus:

    1. Your computer is running slow. 2. Blue screen/black screen crash errors. 3. Pop-ups appear frequently. 4. Your files have suddenly gone missing. 5. Your computer warns you of low storage space.