The command “attrib” It is a computer tool simple to use, which allows you to eliminate the shortcut virus on computers, USB sticks or microSD.
In the next article we will explain how to use attrib command to remove shortcut virus on different devices using simple and quick methods.
How to locate shortcut virus?
The easiest way to find such a virus is to scan all files stored on your computer are replaced by a shortcut and existing folders disappear. However, not all antivirus can detect or eliminate this malware on the computer, so you must use existing tools on the computer, such as the command prompt.
How do you run the attrib command?
There are two simple methods to run the attrib command from a PC, both of which work with any version of the Windows Operating System. Here’s how to use each one.
Using the command console (cmd)
To locate a shortcut virus, you must open the command prompt by pressing the combination Windows + R. Then, type “cmd” (without quotes) and click “OK.” Then, write the letter of the drive to be analyzed and press “Enter”. Subsequently, execute the command “attrib /d /s –r –h –s *.*” omitting the quotes.
To find out the letter that corresponds to the drive in question, you just have to go to “Computer” and see the corresponding information in the flash memory. It is also important to clarify that, between one character and another there must be spaceotherwise the command will not work.
Creating a BAT file
Another simple way to delete direct files and keep it working over time is by creating a BAT file. For this you have to open notepad and type the following command:
“@echo off title=Unhiding files and folders! cls cd echo This small program is capable of recovering programs, music, etc.! echo Author: Walter Idrovo! echo Wait for this window to close by itself! attrib /s /d -r -a -h -s exit”
Note: must be written without quotes and respecting each character.
Then go to File > Save As and assign a name with the .bat extension, for example, cleanup.bat. With this, every time you need to remove a shortcut virus from your computer, you just have to run the file in question to delete it. However, if located on a USB stickyou must write any of the following commands in notepad:
- “attrib -r -a -s -h E:\*.* /S /D attrib -r -a -s -h F:\*.* /S /D attrib -r -a -s -h G: \*.* /S /D attrib -r -a -s -h H:\*.* /S /D”
- “@echo off color a set/p U=What is the unit to be disinfected? pause echo Please wait… attrib -r -a -h -s %U%:\*.* /S /D echo rd C:\8585485 /S echo Finished echo. pause pause”
It should be noted that in both cases the quotes must be omitted. Then, save the .bat file inside the USB stick and run it whenever necessary to remove the shortcut virus.
How to view the attributes of a file with cmd?
To view the attributes of a file from the command prompt you must write the command “attrib” (without quotes), accompanied by the access path to the document and its name. In this way, the type of attribute present in the indicated file will be displayed.
Types of modifiable attributes
There is a list with different attributes that can be viewed, applied, modified or replace using the attrib command. Below is what they are:
- attrib: Allows you to view and/or modify attributes.
- /d: He is responsible for carrying out the procedures related to folders.
- /s: It is responsible for carrying out procedures in subfolders.
- -to: Allows you to know if a file or directory has been modified.
- -h: Used to eliminate hidden attributes.
- -r: Removes the “Read Only” attribute.
- -s: Removes System attributes.
- *.*: Allows you to see the name and extension of the files.
In addition to this, there are a couple of parameters that can be combined with the attrib command to obtain information about the file directory, these are:
- /S: Used to process matching files and also all subfolders within it.
- /D– Used to process folders as well as files.
“Access Denied” error in attrib command
If you get an “access denied” error when trying to run attrib, it can be easily fixed by closing the command prompt and reopening it with administrator privileges. To do this you have to go to “Start” and search “Symbol of the system” then right click on the tool and select “Execute as an administrator”.
How to prevent shortcut virus from appearing?
There are certain recommendations or tips that can be taken into account to prevent the shortcut virus from infecting the PC or a USB memory, some are mentioned below:
- Have a good antivirus on the computer to prevent malicious files from entering the PC.
- Scan any external drive before reviewing its contents on the computer.
- Make backup copies on different dates to restore the system to its original state, in case it becomes infected at some point.
- Be alert to the use of programs from unknown or suspicious sources.
As could be seen, eliminating shortcut viruses on a computer or USB memory is very easy to do, either with the command console or using a .bat file.