繁体   English   中英

我可以在没有换行的情况下运行CMD命令吗?

[英]Can I run a CMD command without a new line?

我试图在不显示暂停命令的情况下运行它,请Press any key to continue . . . Press any key to continue . . . 并且没有创建新行? 我尝试了有人建议的在没有换行的情况下回显文本的方法,但这对我不起作用。

据我所知, pause>nul到此为止,但这会创建一个新行。

这是一个例子:

This is some sample text.

脚本会暂停直到按下某个键。

然后处理其余的:

This is some sample text.Here is the rest.

任何帮助表示赞赏。

不,命令内置于cmd可执行文件中,并且其行为无法更改。 但是,您可以使用回显来模拟命令输出(或者在您的情况下为<nul set /p = )。

@echo off

REM Write the same message that pause prints, but do not include a newline
set /p "=Press any key to continue..." <nul

REM Pause without output
pause >nul

REM Prove that we're still on the same line
echo This is on the same line

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM