none
Generic from .bat (or command prompt) matching too many files RRS feed

  • Question

  • (I originally posted this on Microsoft Community but was told to move it here with no indication of which forum would be appropriate. If it should be on a different forum, please advise.)

    Why, if I do this:

    dir 146*

    do I get a match on this name:

    147166PartVa.pdf

    I get lots of such spurious matches on different generics: this has happened across multiple Windows versions (not just 10) for years, but it's just caused me to have to retrieve a load of deleted files from my backup, which is why I've decided I need to understand what is happening and how I can prevent it.

    I am wondering if this is something to do with the unicode or hex representation of the generic, but it's difficult to see how such an obvious bug could have got through Microsoft's testing processes for so long.

    Thanks

    Mandy

    Monday, December 31, 2018 8:13 PM

Answers

All replies

  • Do a

    Dir /x

    and see if you have a short name that matches.


    David Candy

    • Marked as answer by Mandy Shaw Saturday, January 5, 2019 1:48 PM
    Saturday, January 5, 2019 6:37 AM
  • Well spotted, you've got it, thanks a lot. How do I indicate to dir, erase, etc., that I am talking about the long name of the file, not the short name?

    EDIT: - I have just found the fsutil strip command - that should do the job. Many thanks.

    • Edited by Mandy Shaw Saturday, January 5, 2019 1:48 PM
    Saturday, January 5, 2019 1:27 PM