can't check variable for spaces using find or findstr

this checks %file% for a space and if not found changes dots into spaces.

echo "%file%" | find " " || set "file=%file:.= %"

the problem is that when a filename has no spaces it still behaves as if it does. same with findstr /c:" ". can I force space support here?

1 answer

  • answered 2017-08-12 09:43 Magoo

    Remove the space between "%file%" and the pipe. This space is being included in the stringecho`ed so space is always detected.