中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 14:45
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Regarding the usage of echo: The batch file generated by batch processing always lacks a percent sign
Printable Version  1,476 / 8
Floor1 wzqaxue Posted 2008-09-26 00:36
新手上路 Posts 8 Credits 18

I want to put for /L %%i in (1 1 10) do start cmd into test.bat, but actually what is written into test.txt is for /L %i in (1 1 10) do start cmd, always missing a %, please give advice, I'm a newbie.

───────────────── Moderation Record ─────────────────
Performed by: HAT
Operation: Added search keywords to the post title on 2008-10-10; added code tags to the code
Explanation: The original title "About the usage of echo" was not conducive to forum search
Punishment: No score punishment due to being a forum newbie
Tip: It is suggested to read the following posts
{1415}The Wisdom of Asking Questions
{7326}Must-read for Forum Newcomers, Basic Code of Conduct for Everyone
{22703}Please Don't Be an Impatient Person
{32667}Those Who Can't Even Write a Clear Title, Wake Up
{32825}This Board Strictly Rectifies Poor-quality Posts
───────────────── Moderation Record ─────────────────


[ Last edited by HAT on 2008-10-10 at 05:43 ]
Floor2 DOSforever Posted 2008-09-26 01:01
金牌会员 Posts 2,239 Credits 4,639
Strange, this problem seems very simple. According to my idea, it should only generate one %, but I tried it in CMD and found my two %, which is exactly the result you want. What version of Windows do you have?
Floor3 radem Posted 2008-09-26 01:12
高级用户 Posts 383 Credits 691
Floor4 DOSforever Posted 2008-09-26 01:13
金牌会员 Posts 2,239 Credits 4,639
Do you use 4DOS / 4NT / Take Command? Such a result matches my expectation.
Floor5 radem Posted 2008-09-26 01:32
高级用户 Posts 383 Credits 691
In CMD, it's %%i. In batch processing, it's %%%%i
Floor6 wzqaxue Posted 2008-10-09 23:29
新手上路 Posts 8 Credits 18
Could it be a problem with my Windows version? I'll try it tomorrow %%%%i. Thanks everyone!
Floor7 mimi820 Posted 2008-10-10 22:20
初级用户 Posts 20 Credits 35
Floor8 pkto Posted 2009-10-21 09:55
初级用户 Posts 62 Credits 62
It should be to add one more % character. Special symbols need to be defined in batch processing. For example, for the "|" character, if you want to output it, you need to add a "^" character in front.
Floor9 mwm5 Posted 2009-10-21 17:43
初级用户 Posts 23 Credits 40
Originally posted by radem at 2008-9-26 01:12:
%%%%i

nod
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023