Handling files with embedded spaces

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
I've seen this topic before but not sure if its a bug or you have to add "" to cover these types of files.

Eg Should say
for %in in (*.dll) do echo %in %@SHA1[%in]
work for all files or do you have to use
for %in in (*.dll) do echo %in %@SHA1["%in"]
to catch files with spaces. At the moment you have to use the latter otherwise you get a -1 value.


Staff member
May 14, 2008
You have to double quote the argument.

Originally, I tried to automatically double quote those types of args, but got too many complaints from users who weren't expecting them. The eventual consensus was that it would be the user's responsibility, so that they expected the quotes and made provisions to handle them appropriately.

There were also concerns (with FOR) regarding CMD compatibility, which does not double quote the argument.