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 744,272 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 744,272 times. How helpful is this? Co-authors: 27 Updated: November 19, 2025 Views: 744,272 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 744,272 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: 744,272 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

What Are the Korean Animal Face Types? (And Which Type Do You Have?)What Are the Korean Animal Face Types? (And Which Type Do You Have?)Being the Little Spoon While Cuddling: Is It Better Than the Big Spoon?Being the Little Spoon While Cuddling: Is It Better Than the Big Spoon?115+ Funny “Get Well Soon” Messages to Make Someone Laugh115+ Funny “Get Well Soon” Messages to Make Someone Laugh110+ “Fun Facts” for Interviews, Introductions, & Icebreakers110+ “Fun Facts” for Interviews, Introductions, & IcebreakersHow Long Would You Survive In A Zombie Apocalypse?How Long Would You Survive In A Zombie Apocalypse? Roast Someone in a Rap Battle (Plus the Best Bars of All Time)How to Roast Someone in a Rap Battle (Plus the Best Bars of All Time)

Trending Articles

How Many People Had a Crush on You In 2025?How Many People Had a Crush on You In 2025?What Song Was #1 On My Birthday?What Song Was #1 On My Birthday?Who Is Secretly Crushing On Me Right Now QuizWho Is Secretly Crushing On Me Right Now QuizDiscover the Secret Meaning of Your First NameDiscover the Secret Meaning of Your First NameAnswer These Questions, And We'll Judge YouAnswer These Questions, And We'll Judge You10+ Scary Phone Numbers to Call10+ Scary Phone Numbers to Call

Featured Articles

What Turns a Girl On? 31 Things to Try on Your PartnerWhat Turns a Girl On? 31 Things to Try on Your PartnerLove AnalyzerLove AnalyzerSending Your Sweetie a Love Note? Here are 200+ Romantic IdeasSending Your Sweetie a Love Note? Here are 200+ Romantic IdeasExercise Your BrainHow toExercise Your BrainBe a Fun Person to Hang out WithHow toBe a Fun Person to Hang out WithWhat Does Your Morning Routine Say About You?What Does Your Morning Routine Say About You?

Featured Articles

Develop Productive HabitsHow toDevelop Productive HabitsPractice Self CareHow toPractice Self CareWhat Song Matches Your Life Right Now?What Song Matches Your Life Right Now?Your 2026 Vision: What Does Next Year Hold?Your 2026 Vision: What Does Next Year Hold?Understanding the Most Attractive Face Shapes (& Determining Your Own)Understanding the Most Attractive Face Shapes (& Determining Your Own)Type A B C D Personality TestType A B C D Personality Test

Watch Articles

 Deep Clean Your Kitchen Sink (& Keep It Clean)How to Deep Clean Your Kitchen Sink (& Keep It Clean) Curl Your Hair: 8 Easy & Quick WaysHow to Curl Your Hair: 8 Easy & Quick WaysThicken Sauce with FlourHow toThicken Sauce with Flour Brighten Up White Shirts and Other GarmentsHow to Brighten Up White Shirts and Other Garments Cook White Rice without a Rice CookerHow to Cook White Rice without a Rice Cooker Clean Out the Inside of a Glass Bottle (With or Without a Brush)How to Clean Out the Inside of a Glass Bottle (With or Without a Brush)

Trending Articles

How Vanilla Am I QuizHow Vanilla Am I QuizAttractiveness Score QuizAttractiveness Score QuizKissHow toKissWhat Are My Soulmate's Initials QuizWhat Are My Soulmate's Initials QuizLose Belly Fat in 2 WeeksHow toLose Belly Fat in 2 WeeksWho's My KPop Lookalike QuizWho's My KPop Lookalike Quiz

Quizzes & Games

Am I Smarter Than a High Schooler QuizAm I Smarter Than a High Schooler QuizTake QuizLeetspeak 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 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 --507

Tag » How To Remove Virus Using Cmd