The where command is broken for directory names containing spaces.

Copper Contributor

I noticed that if a directory name contains spaces, and the directory is in the PATH, the where command is unable to find anything in that directory.

For example, 7-zip is installed in C:\Program Files\7-zip.
The PATH is "C:\Program Files\7-zip";<rest of path goes here>
I can execute the 7z.exe program from the command line, but the where command will not find it.  For example:
C:\>where 7z
INFO: Could not find files for the given pattern(s).

If I copy it to a directory with a name which does not contain spaces, the where command finds it.

C:\>copy "c:\program files\7-zip\7z.exe" \temp
1 file(s) copied.

C:\>set path=%path%;c:\temp

C:\>where 7z
c:\temp\7z.exe

C:\>ver

Microsoft Windows [Version 10.0.19045.3324]



If I'm wrong, please let me know.  Otherwise, I'm just posting in the hope that Microsoft will find this needle in the haystack of a message and fix the problem.  



0 Replies