如何清除批量而不是整个屏幕中的选定行? [英] How to clear selected lines in Batch instead of the whole screen?

查看:76
本文介绍了如何清除批量而不是整个屏幕中的选定行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们使用pause时,它显示按任意键继续...".按下任意键后,后一个文本将保留,其余文本将显示在其下方.如果在pause之后使用cls,则会清除整个屏幕.

When we use the pause it shows "Press any key to continue . . .". After pressing any key, the latter text remains, and the remaining text appears below it. If I use cls after pause the whole screen gets cleared.

是否有任何方法只能删除按任意键继续...".按任何键后?另外,如何清除仅选定的行而不是清除整个屏幕?

Is there any method to remove only "Press any key to continue . . ." after pressing any key? Also, how do I clear only selected lines instead of clearing the whole screen?

推荐答案

此问题有多种解决方案,但批处理不提供简单的解决方案.

There are multipe solutions for this problem, but batch doesn't offer a simple one.

批处理的主要问题是不能使用普通命令将光标向上移动.

The main problem of batch is, that you can't move the cursor up with normal commands.

1)您可以使用cls清除屏幕并再次重画所有必要的数据.

1) You can use cls to clear the screen and redraw all necessary data again.

2)您可以使用外部程序来移动光标(该程序可以动态创建 ),例如

2) You can use an external program to move the cursor (this programs can be created on the fly), like Move Cursor to 0,0

3)您可以滥用timeout命令返回第二行 使用TIMEOUT命令将光标移到屏幕首页!,这是 Aacini

3) You can abuse the timeout command to go back to the second line Move cursor to screen home with TIMEOUT command!, a very cool trick discovered by Aacini

4)在Windows 10中,您可以使用Ansi-Escape序列移动光标并获得许多其他效果,但仅适用于Win10

4) With Windows 10 you can use Ansi-Escape sequences to move the cursor and get many other effects, but it will work only for Win10

这篇关于如何清除批量而不是整个屏幕中的选定行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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