在批处理脚本中更改暂停命令的输出 [英] Change output of pause command in batch script

查看:181
本文介绍了在批处理脚本中更改暂停命令的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写Windows批处理脚本.默认情况下,pause命令将暂停脚本并显示文本按任意键继续..."..

I'm writing a Windows batch script. By default, the pause command will pause the script and display the text "Press any key to continue...".

如何修改此文本以向用户显示我自己的文本?

How do I modify this text to display my own text to the user?

推荐答案

您可以使用以下方法隐藏pause命令中的文本:

You could hide the text from the pause command by using this:

pause >nul

然后,您可以回显自己的消息,告诉用户它已暂停:

Then you could echo your own message to tell the user it has paused:

echo The batch file has paused

因此完整的脚本可能看起来像这样:

So the full script might look like this:

@echo off
echo Hello World!
echo The batch file has paused
pause >nul

希望这会有所帮助:)

这篇关于在批处理脚本中更改暂停命令的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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