FORFILES with spaces in the path

I am trying to run this command in dos

FORFILES with params /P C:\Builds\ /M *.chm /S /C "cmd /c copy @file C:\My Brand\"

It is bombing because there is a space in the path to the destination folder. How do I pass the source and destination path limited by the character "? I tried to add an extra double quote, and I got the command" not recognized "

+4
source share
2 answers

0x22 is a double quote representation (hexadecimal encoding).

FORFILES /P C:\Builds\ /M *.chm /S /C "cmd /c copy @file 0x22C:\My Brand\0x22"
+6
source

Reset quotes associated with the destination route using a backslash:

FORFILES /P C:\Builds\ /M *.chm /S /C "cmd /c copy @file \"C:\My Brand\\""
+3
source

Source: https://habr.com/ru/post/1534269/


All Articles