Raffaeu
Raffaeu

Reputation: 6973

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 bombs because there is a space in the destination folder path. How can I pass the source and destination path delimited by ""? I tried by adding an additional double quote and I get "command not recognized"

Upvotes: 6

Views: 5796

Answers (2)

foxidrive
foxidrive

Reputation: 41224

0x22 is a representation of a double quote (hex encoded).

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

Upvotes: 7

Laf
Laf

Reputation: 8185

Escape the quotes surrounding the destination path with a backslash:

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

Upvotes: 5

Related Questions