Home computickets What's wrong with the for (cmd) cycle?

What’s wrong with the for (cmd) cycle?

Author

Date

Category

I start working with CMD and immediately I can not perform the first task of the tutorial – to create a cycle according to the instructions (although I copy the word word)

for %% i in (1,1,4) do (echo a)

It gives

Unforeseen appearance: %% i.

All other cycles also do not work. I tried to enter into quotes. Does not work. Maybe the problem is in the CMD itself? What are there any options?
(This is a console, not Bat, if that)


Answer 1, Authority 100%

Checked – Works, just in case I checked with % i to call the error

PS C: \ Users \ Fireman & gt; D:
PS D: \ & GT; . \ Test.cmd.
D: \ & GT; for% i in (1 1 4) do (echo a)
D: \ & GT; (Echo a)
A.
D: \ & GT; (Echo a)
A.
D: \ & GT; (Echo a)
A.
PS D: \ & GT; . \ Test.cmd.
Unforeseen appearance: i.
D: \ & gt; for i in (1,1,4) do (echo a)
PS D: \ & GT;

Try it again Copy / write code in a separate .cmd and start

p.s.

In the command line, it works

for% i in (1, 2, 3) do echo% i

In PowerShell does not work – but this is another story 🙂

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions