我如何只清除一行cmd? [英] How do I clear ONLY ONE LINE of cmd?

查看:370
本文介绍了我如何只清除一行cmd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在cmd中添加了一些东西.我希望有一个使用文本的进度条,以便它像[.........],但是当我键入CLS来清除该行,并键入ECHO以重新制作一行时,CLS会清除该行.整个屏幕.我只想清除一行!我该怎么办?

So, I have added some stuff in cmd. I want there to be a progress bar using text, so that it is like [......... ], but when I type in CLS to clear the line and ECHO to remake with an extra one, CLS clears the entire screen. I want it to clear ONLY ONE LINE! How do I do it?

我知道没有一个命令可以执行此操作,但是使用FOR命令是否可以使用FOR和其他功能(但不是任何第三方)执行该操作?

I know there is NOT a command that does that, but using the FOR command, is it possible to do it with FOR and some other stuff (BUT NOT ANY THIRD PARTIES)?

我希望答案是肯定的.

这是我想要和不想要的东西的一个示例:

Here's an example of what I want and don't want:

https://ou.wistia.com/medias/xkxld1i3vy

这不能满足我的需求!我不想下载其他任何内容!只需复制答案中的代码即可!

This doesn't do what I needed! I don't want to download anything else! Just copy the code from your answer!

推荐答案

使用类似这样的内容:

@echo off
setlocal enableDelayedExpansion

:: Define CR to contain a carriage return (0x0D)
for /f %%A in ('copy /Z "%~dpf0" nul') do set "CR=%%A"

<nul set/p"=[*............]!CR!"
pause >nul
<nul set/p"=[**...........]!CR!"
pause >nul
<nul set/p"=[***..........]!CR!"
pause >nul

从这里

这篇关于我如何只清除一行cmd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆