How To Locate Viruses Using The Attrib Command: 11 Steps - WikiHow

Skip to ContentQuizzes
  • Home
  • Random
  • Browse Articles
  • Quizzes & Games
  • All QuizzesHot
  • Love Quizzes
  • Personality Quizzes
  • Fun Games
  • Dating Simulator
  • Learn Something New
  • Forums
  • Courses
  • Happiness Hub
  • Explore More
  • Support wikiHow
  • About wikiHow
  • Log in / Sign up
Terms of Use wikiHow is where trusted research and expert knowledge come together. Learn why people trust wikiHow How to Locate Viruses Using the Attrib Command PDF download Download Article Co-authored by Efficient IT Services and Jack Lloyd

Last Updated: November 19, 2025 Fact Checked

PDF download Download Article
  • Opening Command Prompt
  • |
  • Locating and Deleting Viruses
  • |
  • FAQ
  • |
  • Video
|Show more |Show less X

This article was co-authored by Efficient IT Services and by wikiHow staff writer, Jack Lloyd. Efficient IT Services is an IT support service provider based in Anderson, South Carolina. They provide proactive, reliable residential IT services and local IT support for businesses in Anderson, Greenville, and Upstate South Carolina. Their services include providing managed IT services, cybersecurity solutions, network systems support, and computer support services. The team is highly experienced and stays current on the latest training and relevant industry standard certifications (DELL, CCNA & CCNA Security) to provide the highest quality of service to customers. Efficient IT Services takes pride in its work and provides IT services to help its community and drive the local economy forward. This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources. This article has been viewed 743,711 times.

This wikiHow teaches you how to find and remove a virus that you know by name from your Windows computer. To do so, open the Command Prompt as an administrator and type your directory name. Find your virus, and then run the delete prompt.

Quick Steps

  1. Open the Command Prompt.
  2. Type your directory name and press Enter.
  3. Type attrib -r -a -s -h *.* and press Enter.
  4. Find your virus name.
  5. Type del [virus name] and press Enter.

For popular FAQs on using command prompt to locate viruses, jump to more common questions.

Steps

Part 1 Part 1 of 2:

Opening Command Prompt

PDF download Download Article
  1. Step 1 Open the Start menu. 1 Open the Start menu. Click the Windows logo in the bottom-left corner of the screen, or press the Win key on your keyboard.
    • For Windows 8, place your mouse cursor in the top-right corner of the screen, then click the magnifying glass icon when it appears.
  2. Step 2 Type command prompt into the "Search" field. 2 Type command prompt into the "Search" field. Doing so will search your computer for the Command Prompt app, which will pop up at the top of the search menu.
    • If you're using Windows XP, you'll instead click the Run app on the right side of the Start menu.
    Advertisement
  3. Step 3 Right-click Command Prompt. 3 Right-click Command Prompt. It resembles a black box. Doing this will invoke a drop-down menu.
    • If you're using Windows XP, you'll instead type cmd.exe into the Run window.
  4. Step 4 Click Run as administrator. 4 Click Run as administrator. It's near the top of the drop-down menu. Doing so will open Command Prompt with administrator privileges.
    • You'll need to confirm this choice by clicking Yes when prompted.
    • If you're using Windows XP, you'll click OK to open Command Prompt.
    • You won't be able to run Command Prompt in administrator mode if you're on a restricted, public, or networked computer (e.g., a library or school computer).
  5. Advertisement
Part 2 Part 2 of 2:

Locating and Deleting Viruses

PDF download Download Article
  1. Step 1 Type in your directory's name. 1 Type in your directory's name. This will typically be the letter on the disk drive (e.g., "C:").
  2. Step 2 Press ↵ Enter. 2 Press Enter. This will change the Command Prompt's search location to your selected directory.
  3. Step 3 Type attrib -r -a -s -h *.* into Command Prompt. 3 Type attrib -r -a -s -h *.* into Command Prompt. The "attrib" command forces all hidden, read-only, archived, and system files to display in Command Prompt, and the "-r -a -s -h *.*" section of the command removes these attributes from non-legitimate files.
    • Any legitimate system files won't have their attributes removed, and you'll see "Access Denied" listed to the left of them.
  4. Step 4 Press ↵ Enter. 4 Press Enter. Doing so will display all previously hidden system files' names.
  5. Step 5 Scroll up to find your virus. 5 Scroll up to find your virus. If you know the virus' name, you'll simply need to scroll up to it. Otherwise, look for files ending in ".inf" and ".exe" that don't look familiar.
    • Before proceeding, be sure to double-check any file names you suspect of being viruses by looking them up.
    • Common virus names include "autorun.inf" and "New Folder.exe".[1]
  6. Step 6 Type del [file name] and press ↵ Enter. 6 Type del [file name] and press Enter. Doing so will remove the virus from your computer.[2]
    • For example: to delete the "autorun.inf" virus, you'd type in del autorun.inf.
  7. Step 7 Close Command Prompt. 7 Close Command Prompt. The virus should no longer affect your system. You may even notice a slight increase in computer running speed or app response time.
  8. Advertisement

Common Questions: Removing Viruses with CMD

Can I find malware with the Command Prompt?

You can find viruses and malware with the Attrib command in Command Prompt. Once located, you can delete them from your computer.

How do I clean my computer using CMD?

Use the command: attrib -r -a -s -h *.* to find any viruses on your computer. If you find any, use the command: del [virus name].

What is the CMD.exe virus?

This virus mimics the Command Prompt, an application that comes with your device. If you suspect you have a virus, consider running an antivirus scan if nothing comes up in the Command Prompt.[3]

Video

Tips

Submit a Tip All tip submissions are carefully reviewed before being published Name Please provide your name and last initial Submit Thanks for submitting a tip for review!

You Might Also Like

Delete a File Using Command PromptHow toDelete a File Using Command Prompt Use MS DOSHow to Use MS DOS Delete DLL FilesHow toDelete DLL Files Create and Delete Files and Directories from Windows Command PromptHow toCreate and Delete Files and Directories from Windows Command Prompt Remove Shortcut Virus on WindowsHow to Remove Shortcut Virus from a Windows PC or Laptop Hide Files in CmdHow to Hide Files in Windows Using CMD Remove a Virus From a Flash DriveHow toRemove a Virus From a Flash Drive Find All Commands of CMD in Your ComputerHow to Display and Use CMD Commands: A List and Guide Remove Newfolder.Exe VirusHow toRemove Newfolder.Exe Virus Open the Hidden Files in a USB Pen Drive3 Ways to Unhide Files on a USB Pen Drive: Windows & Mac Detect Encrypted FilesHow to Find and Detect Encrypted Files on a Computer Run a Program on Command PromptHow to Run a Program at the Windows Command Prompt: 2 Ways Delete a File in Microsoft Windows Using Batch FilesHow toDelete a File in Microsoft Windows Using Batch Files Delete a File or Folder Showing Error "Access Is Denied"How toDelete a File or Folder Showing Error "Access Is Denied" Advertisement

References

  1. https://fossbytes.com/remove-virus-using-cmd/
  2. http://www.easeus.com/resource/use-cmd-remove-virus-windows-10.html
  3. Efficient IT Services. IT Support Expert. Expert Interview

About This Article

Efficient IT Services Co-authored by: Efficient IT Services IT Support Expert This article was co-authored by Efficient IT Services and by wikiHow staff writer, Jack Lloyd. Efficient IT Services is an IT support service provider based in Anderson, South Carolina. They provide proactive, reliable residential IT services and local IT support for businesses in Anderson, Greenville, and Upstate South Carolina. Their services include providing managed IT services, cybersecurity solutions, network systems support, and computer support services. The team is highly experienced and stays current on the latest training and relevant industry standard certifications (DELL, CCNA & CCNA Security) to provide the highest quality of service to customers. Efficient IT Services takes pride in its work and provides IT services to help its community and drive the local economy forward. This article has been viewed 743,711 times. How helpful is this? Co-authors: 27 Updated: November 19, 2025 Views: 743,711 Categories: Command Prompt | Computer Viruses Article SummaryX

1. Type "cmd" into the Windows search bar. 2. Right-click Command prompt. 3. Click Run as administrator. 4. Click Yes. 5. Type "cd ' and press Enter. 6. Type "attrib –r –a –s –h *.*" and press Enter. 7. Look for the virus in the list of files. 8. Type "del " and press Enter. Did this summary help you?YesNo

In other languages Spanish Portuguese Russian French Indonesian Dutch Arabic Chinese
  • Print
  • Send fan mail to authors
Thanks to all authors for creating a page that has been read 743,711 times.

Reader Success Stories

  • Herry Casillas

    Herry Casillas

    Dec 6, 2016

    "Yes, it did help. Before reading this info, I honestly had no idea what I was dealing with or what to even look..." more
More reader stories Hide reader stories Share your story

Is this article up to date?

Yes No Advertisement Cookies make wikiHow better. By continuing to use our site, you agree to our cookie policy. Efficient IT Services Co-authored by: Efficient IT Services IT Support Expert Click a star to vote Co-authors: 27 Updated: November 19, 2025 Views: 743,711 Herry Casillas

Herry Casillas

Dec 6, 2016

"Yes, it did help. Before reading this info, I honestly had no idea what I was dealing with or what to even look..." more Balveer A.

Balveer A.

Feb 3, 2017

"Thanks heaps! You are so helpful, as always." Share yours! More success stories Hide success stories

Quizzes & Games

Am I Chronically Online QuizAm I Chronically Online QuizTake QuizOCD TestOCD TestTake QuizDemon Name GeneratorDemon Name GeneratorGenerate NamesHow Skibidi Am I QuizHow Skibidi Am I QuizTake QuizWhich Creepypasta Am I QuizWhich Creepypasta Am I QuizTake QuizWould I Be a Good Super Spy QuizWould I Be a Good Super Spy QuizTake Quiz

You Might Also Like

Delete a File Using Command PromptHow toDelete a File Using Command PromptUse MS DOSHow to Use MS DOSDelete DLL FilesHow toDelete DLL FilesCreate and Delete Files and Directories from Windows Command PromptHow toCreate and Delete Files and Directories from Windows Command Prompt

Featured Articles

Dress for WinterHow toDress for WinterNicknames for Your Girlfriend: 125+ Funny, Sweet & Clever IdeasNicknames for Your Girlfriend: 125+ Funny, Sweet & Clever Ideas Give Someone a Great GiftHow to Give Someone a Great GiftWhat Would My Life At Camp Half-Blood Be Like QuizWhat Would My Life At Camp Half-Blood Be Like QuizThe Best Hairstyles for Guys with Big ForeheadsThe Best Hairstyles for Guys with Big Foreheads22 Best Ideas for Scary (and Funny) Pranks22 Best Ideas for Scary (and Funny) Pranks

Trending Articles

How Much Do I Mog QuizHow Much Do I Mog QuizHow Weird Am I QuizHow Weird Am I QuizCan We Guess How Tall You Are QuizCan We Guess How Tall You Are QuizAm I Annoying QuizAm I Annoying QuizLet Us Rate You 1-10: Attractiveness Scale QuizLet Us Rate You 1-10: Attractiveness Scale QuizWhat Would My Life At Camp Half-Blood Be Like QuizWhat Would My Life At Camp Half-Blood Be Like Quiz

Featured Articles

 Text Yourself: Fake Text Messages, Reminders, and MoreHow to Text Yourself: Fake Text Messages, Reminders, and MoreAccurate Omegaverse Quiz: 100% GuaranteeAccurate Omegaverse Quiz: 100% GuaranteeThe Hardest & Most Difficult Riddles for AdultsThe Hardest & Most Difficult Riddles for Adults Be More Spontaneous and Enjoy Life to the FullestHow to Be More Spontaneous and Enjoy Life to the FullestImprove Your PersonalityHow toImprove Your PersonalitySigns You Were Meant For Greatness (Quiz)Signs You Were Meant For Greatness (Quiz)

Featured Articles

210+ Shower Thoughts: Funny, Deep, Weird & Mind-Blowing210+ Shower Thoughts: Funny, Deep, Weird & Mind-Blowing Meet Gay People Without a Dating AppHow to Meet Gay People Without a Dating AppCute, Thoughtful & Romantic Messages to Wish Her a Good Day at WorkCute, Thoughtful & Romantic Messages to Wish Her a Good Day at WorkWhat Movie Should I Stream QuizWhat Movie Should I Stream QuizWhat Does the Term "Femboy" Mean?What Does the Term "Femboy" Mean?40+ Fun & Exciting Group Game Ideas to Play with 20+ People40+ Fun & Exciting Group Game Ideas to Play with 20+ People

Watch Articles

 Marinate Chicken: 4 Recipes and a Step-By-Step GuideHow to Marinate Chicken: 4 Recipes and a Step-By-Step GuideClean Shower TileHow toClean Shower TileDo Oblique CrunchesHow toDo Oblique CrunchesSimple Ways to Riffle Shuffle and Bridge Playing CardsSimple Ways to Riffle Shuffle and Bridge Playing CardsMake Black CoffeeHow toMake Black CoffeePlant a Seed in a PotHow toPlant a Seed in a Pot

Trending Articles

What's Special About Me QuizWhat's Special About Me QuizHow Many People Actually Find Me Intimidating QuizHow Many People Actually Find Me Intimidating QuizHow Nonchalant Am I QuizHow Nonchalant Am I QuizThe World's Hardest Riddles (for Kids & Adults)The World's Hardest Riddles (for Kids & Adults)1, 2, 1, 2, 3, Release ‘Em: All About This Viral TikTok Trend1, 2, 1, 2, 3, Release ‘Em: All About This Viral TikTok TrendHow Would My Fandom See Me If I Were a Fictional Character QuizHow Would My Fandom See Me If I Were a Fictional Character Quiz

Quizzes & Games

Leetspeak TranslatorLeetspeak TranslatorGenerateStar Wars Name GeneratorStar Wars Name GeneratorGenerate NamesHow Will I Die QuizHow Will I Die QuizTake QuizRandom Name GeneratorRandom Name GeneratorGenerate NamesName the Meme QuizName the Meme QuizTake QuizIQ TestIQ TestTake Quiz wikiHow
  • Categories
  • Computers and Electronics
  • Computers
  • Computer Viruses
wikiHow Newsletter You're all set! Helpful how-tos delivered toyour inbox every week! Sign me up! By signing up you are agreeing to receive emails according to our privacy policy.
  • Home
  • About wikiHow
  • Experts
  • Jobs
  • Contact Us
  • Site Map
  • Terms of Use
  • Privacy Policy
  • Do Not Sell or Share My Info
  • Not Selling Info
  • Contribute

Follow Us

×

wikiHow Tech Help:

Tech troubles got you down? We've got the tips you need

Subscribe You're all set! X --652

Tag » How To Remove Virus Using Cmd