0

Strange enough but I haven't found a way for this task:

In a simple batch (i.e. not powershell etc.) I would like to make a distinction if a file is a a directory or just a simple file.

But with if exist or attrib I haven't found a way.

Is there any?

User42
  • 83
  • 10
  • how about `dir /b /ad whatever` – elzooilogico Sep 29 '20 at 18:09
  • Oh yes, actually that distinguishes between them: It returns the dir name if it is a dir and "nothing found" (transl.) if it is not a dir. But how do I use that in the command flow of a batch, please? Something like if dir /b /ad %1 = %1 ? – User42 Sep 29 '20 at 18:44
  • 2
    maybe `(dir /b /ad | find /i “whatever”) && echo(is a directory || (if exist “whatever” echo(is a file else echo(not found)` may need some adjustment, as include in a `for` loop or testing against a var content, but may be a starting point – elzooilogico Sep 29 '20 at 18:47
  • @Squashman: There will be the answer something in the thread you kindly provided. But I need some time to understand. – User42 Sep 29 '20 at 18:51

0 Answers0