Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6043197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:52:23+00:00 2026-05-23T06:52:23+00:00

There is a virus in our network that sets all root directories attributes hidden

  • 0

There is a virus in our network that sets all root directories attributes hidden & system at usb flash drives and creates lnk-files, that run cmd.exe, virus itself and then open directories, so to cure such drives I use the commands:

attrib -s -h -r /d /s
del /q /s *.lnk
rd /q /s recycler

But there is a problem: command “attrib -s -h -r /d /s” processes all files and directories recursively and if there are many of them it takes too long (it looks like Windows first creates full file list and then begins to processes everything).

Is there a possibility to process only directories NOT files and not recursively with a bat-file?

Like in perl:

opendir D, '.';
while($_ = readdir D){
    if(-d $_){
        #do something
        }
    }
closedir D;

Thank you.

—
UPD: 2012-01-31, the solution:

for /f "delims=" %i in ('dir /ad /ah /b') do @attrib -r -s -h -a "%i"

(replace %i with %%i to use in batch files)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:52:24+00:00Added an answer on May 23, 2026 at 6:52 am

    Use the FOR command, with a DIR output as working list.

    For example you start with this :

    attrib /s /d
       SHR     C:\a\a.1
       SHR     C:\a\a.2
       SHR     C:\a\a.3
       SHR     C:\a
       SHR     C:\b
       SHR     C:\c
       SHR     C:\d
    A          C:\x.txt
    A          C:\y.txt
    A          C:\z.txt
    

    Where a, b, c and d are directories, and a has subdirectories. Type this command (remember to use %% if you put in in a batch file) :

    for /f %i in ('dir /ad /ah /b') do @attrib -r -s -h %i
    

    Which will give you what you want :

    attrib /s /d
       SHR     C:\a\a.1
       SHR     C:\a\a.2
       SHR     C:\a\a.3
               C:\a
               C:\b
               C:\c
               C:\d
    A          C:\x.txt
    A          C:\y.txt
    A          C:\z.txt
    

    From your question, I understand that processing subdirectories should be avoided. If not, comment on my answer and I’ll fix it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our company uses Sophos Anti-Virus with a default configuration that performs on-access scanning on
There is a virus that my brother got in his computer and what that
I have an executable file (program.exe) That is virus infected. Is there any possible
Is there a machine learning concept (algorithm or multi-classifier system) that can detect the
I know that there is no way to fully protect our code. I also
We've got a few pages in our web systems that use the .net system.net.mail
I remember a few years ago(2002) there was a multipartite virus that could be
I'm currently conceiving a system that works like an anti-virus, but also uses the
There is a conversion process that is needed when migrating Visual Studio 2005 web
There are several types of objects in a system, and each has it's own

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.