I have a file with two columns of file name. The following command lists the content of the file.

(for /f "usebackq delims=;" %i in ("C:\RENAME-ALL.txt")  DO ECHO %i

When I put the same command in a batch file, changed %i to %%i, and executed the batch file, nothing happened except the prompt became "C:\>c:\>"

What is the proper syntax of that line in a batch file? Thanks.

Windows 7

1 Answer 1


The command you posted cannot work on the command line, and of course it won't work in batch, even after doubling the percents. You have an open parenthesis on the left that is never closed. You could add a closing parenthesis to the right, but the simplest solution is to remove the opening parenthesis.

The following should work fine within a batch file.

for /f "usebackq delims=;" %%i in ("C:\RENAME-ALL.txt") DO ECHO %%i

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .