FOR command cannot see hidden files

Posted by Synetech on Super User See other posts from Super User or by Synetech
Published on 2012-09-16T19:06:18Z Indexed on 2012/09/16 21:42 UTC
Read the original article Hit count: 456

Filed under:
|
|
|
|

I’m struggling with one of the most frustrating bugs I’ve ever come across.

Bug description:

  The for command of the command-interpreter cannot see hidden files.

Reproduction steps:

  1. Create a temporary directory
  2. Create a few files
  3. Assign a variety of attributes to the files (including hidden)
  4. Use a command like for %i in (*) do echo "%i"

Expected results:

   All files are processed in the for loop either by default or though a switch.

Actual results:

  • Files with any attribute other than hidden are processed; files flagged as hidden are skipped
  • There is no switch to the for command to allow it to process hidden files

Implications:

   There is no way to process all files from the command-prompt.

Question:

   How the heck can hidden files be processed from the command-prompt or batch-files (at least in Windows if not DOS)?

© Super User or respective owner

Related posts about Windows

Related posts about command-line