E
E
Erdik2021-11-09 09:37:30
cmd/bat
Erdik, 2021-11-09 09:37:30

Why is there a syntax error in the command?

618a1754444f4858749352.pngThe essence of the following is given a bunch of folders with the same exe inside (I took txt for the test) and you need to run them all
. I do the following
chcp 1251
for %%a in ('dir /A:D /b') do
Start notepad.exe 'C :\\Folder\' + %%a + '\test.txt'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2021-11-09
@Erdik

Write the start command right after do.
Or you can wrap start in parentheses. The opening parenthesis must come after do on the same line.
Those. for together with the body of the loop is one cmd command and must be on the same line. Parentheses allow you to get around this limitation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question