Windows回声覆盖以前的回声 [英] windows echo to overwrite previous echo
本文介绍了Windows回声覆盖以前的回声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在批处理文件中,我想在屏幕上写一个计数器,而不用滚动屏幕外的内容。我有
In a batch file, I want to write a "counter" to the screen without scrolling stuff off the screen. I have
FOR /L %%i IN (1,1,1000) DO (
< NUL set /P="Count= %%i"
)
{ < < NUL
,但这会阻止该行显示在问题中。}
{There is no space between < LT> NUL
but this stops the line from showing in the question.}
此命令不会添加LF或CR,但我确实希望
This command doesn't add a LF or CR, but I do want a CR, just no LF.
最终结果应该是
Count= X
其中X是从1到1,000的计数。
where X is "counting" from 1 to 1,000.
推荐答案
@echo off
setlocal EnableDelayedExpansion
rem Get a Carriage Return (Ascii 13) in CR variable:
for /F %%a in ('copy /Z "%~F0" NUL') do set "CR=%%a"
FOR /L %%i IN (1,1,1000) DO ( < NUL set /P "=Count= %%i!CR!" )
这篇关于Windows回声覆盖以前的回声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文