Saturday 15 September 2012

windows - Escape parentheses in nested batch for loop? -


I have a folder that has unrecognized .txt files, like Named:

  Todo .txt todo (1) .txt todo (2) .txt todo (3) .txt   

I repeat this command through the files and print to print the text on each Line within the file: for / R / F in test (test \ * .txt) (for / f% p in (% f) echo% p) < P> / R returns the filenames properly and will output the line of each text in / f tod But when it hits todo (1) .txt , then it commands to / f% p (C: \ test \ todo (1) .txt) echo% p and can not find the error system C: \ test \ todo file.

How do you avoid brackets in this situation?

Use the usebackq option ("% F") in / Usebackq "for% p (for test \ * .txt), file name for / r% f

  allow double-quote% P)    

No comments:

Post a Comment