Batch file 如何让cmd输出更少的信息

Batch file 如何让cmd输出更少的信息,batch-file,cmd,Batch File,Cmd,我有一个批处理文件,例如:test.bat,其中只有一个命令: echo Hello 然后我运行它: D:\cmd\test.bat 然后输出结果: //output begin -- This is a blank line, I don't want this D:\cmd\echo Hello -- This is not what I want Hello -- I only want to print

我有一个批处理文件,例如:
test.bat
,其中只有一个命令:

echo Hello
然后我运行它:

D:\cmd\test.bat
然后输出结果:

 //output begin
                     -- This is a blank line, I don't want this
 D:\cmd\echo Hello   -- This is not what I want
 Hello               -- I only want to print this line
                     -- This is a blank line, I don't want neither.
 //output end
我只想打印批处理文件中运行的命令的输出,下面是
echo
命令

但是,有两个空行,一个在结果的开头,另一个在结果的结尾。结果中的
D:\cmd\echo Hello
也不是我想要的

我该怎么办?任何帮助都会很好,提前谢谢。

放在

@echo off
在批处理文件的第一行中。这将在命令运行时阻止命令调用的输出(就像在命令前面加@),因此它消除了所有困扰您的行

取自


好吧,如果你再把它全部重写一遍,那就没有意义了;)我的错,我想我只是和你在同一时间编辑,如果你喜欢,你可以重新添加,或者我可以回去添加。谢谢!最后一行空行似乎无法删除。
cmd.exe
在刷新输出时是否会自动附加一个空行?这将删除您不需要的大多数行,@srain。最后一个空行是DOS的“工作方式”(如果您有一个没有命令的空.bat文件,它仍然会发出一个空行)。如果你想摆脱它,你必须使用DOS以外的东西(AFAIK)。@HarryPehkonen,好的。谢谢
Type ECHO without parameters to display the current echo setting (ON or OFF).

In most batch files you will want ECHO OFF, turning it ON can be useful when 
debugging a problematic batch script.

In a batch file, the @ symbol is the same as ECHO OFF applied to the current line only.

Normally a command is executed and takes effect from the next line onwards, @ 
is a rare example of a command that takes effect immediately.