cnblogs/dcrenl/批处理 ECHO命令输出空行.html

39 lines
4.1 KiB
HTML
Raw Permalink Normal View History

2024-09-24 12:43:01 +08:00
<p><span style="color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif; line-height: 25px; background-color: #f7fcff;"> 众所周知如果echo后面跟一个环境变量但是该变量却为空时相当于不加任何参数的echo即输出当前echo是on还是off。很多文章或者教程给出的解决方案都是在echo后面加一个点号echo.,这样就会输出空行。&nbsp;</span></p>
<div style="padding: 0px 3px; margin: 3px auto 0px; border-left-color: #0099cc; border-left-width: 1px; border-left-style: solid; width: 600px; background-color: #f2f6fb; clear: both; border-top-color: #0099cc; border-top-width: 1px; border-top-style: solid; border-right-color: #0099cc; border-right-width: 1px; border-right-style: solid; line-height: 25px; color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif;"><span style="padding: 0px; margin: 0px; float: right; line-height: 25px; cursor: pointer;"> <span style="padding: 0px; margin: 0px; text-decoration: underline;">复制代码</span></span>代码如下:</div>
<div style="padding: 0px 3px 0px 5px; margin: 0px auto 3px; border: 1px solid #0099cc; width: 598px; background-color: #ddedfb; clear: both; line-height: 25px; color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif;"> <br style="padding: 0px; margin: 0px;" />
@echo off&nbsp;<br style="padding: 0px; margin: 0px;" />
echo <20>mon.tw%&nbsp;<br style="padding: 0px; margin: 0px;" />
:: ECHO is off.&nbsp;<br style="padding: 0px; margin: 0px;" />
echo.<2E>mon.tw%&nbsp;</div>
<p>
<br style="padding: 0px; margin: 0px; color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif; line-height: 25px; background-color: #f7fcff;" />
<span style="color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif; line-height: 25px; background-color: #f7fcff;">
pause据我所知用echo输出空行至少有十种方法&nbsp;</span></p>
<div style="padding: 0px 3px; margin: 3px auto 0px; border-left-color: #0099cc; border-left-width: 1px; border-left-style: solid; width: 600px; background-color: #f2f6fb; clear: both; border-top-color: #0099cc; border-top-width: 1px; border-top-style: solid; border-right-color: #0099cc; border-right-width: 1px; border-right-style: solid; line-height: 25px; color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif;">
<span style="padding: 0px; margin: 0px; float: right; line-height: 25px; cursor: pointer;">
<span style="padding: 0px; margin: 0px; text-decoration: underline;">复制代码</span></span>代码如下:</div>
<div style="padding: 0px 3px 0px 5px; margin: 0px auto 3px; border: 1px solid #0099cc; width: 598px; background-color: #ddedfb; clear: both; line-height: 25px; color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif;">
<br style="padding: 0px; margin: 0px;" />
@echo off&nbsp;<br style="padding: 0px; margin: 0px;" />
<br style="padding: 0px; margin: 0px;" />
echo=&nbsp;<br style="padding: 0px; margin: 0px;" />
echo,&nbsp;<br style="padding: 0px; margin: 0px;" />
echo;&nbsp;<br style="padding: 0px; margin: 0px;" />
<br style="padding: 0px; margin: 0px;" />
echo+&nbsp;<br style="padding: 0px; margin: 0px;" />
echo/&nbsp;<br style="padding: 0px; margin: 0px;" />
echo[&nbsp;<br style="padding: 0px; margin: 0px;" />
echo]&nbsp;<br style="padding: 0px; margin: 0px;" />
<br style="padding: 0px; margin: 0px;" />
echo:&nbsp;<br style="padding: 0px; margin: 0px;" />
echo.&nbsp;<br style="padding: 0px; margin: 0px;" />
echo\&nbsp;<br style="padding: 0px; margin: 0px;" />
pause&nbsp;</div>
<p>
<br style="padding: 0px; margin: 0px; color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif; line-height: 25px; background-color: #f7fcff;" />
<span style="color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif; line-height: 25px; background-color: #f7fcff;">
这十种方法可以分为三组每组的效率依次递减。可悲的是那些被奉为经典的教程给出的却是效率最低那组中的echo.&nbsp;</span></p>
<div><span style="color: #333333; font-family: Arial, Tahoma, Verdana, sans-serif;"><span style="line-height: 25px;">本文件截取自:</span></span><a href="http://www.jb51.net/article/30987.htm">http://www.jb51.net/article/30987.htm</a></div>
<p>&nbsp;</p>