批处理中如何输出几段代码到一个文本里面?
比如如下命令,在a.bat里面把下面的内容单独储存在b.bat里面,本人菜鸟一枚。用echo一段一段来好像很不科学,有什么符号或者方法可以一次性将它们输入到一个文本里面吗...
比如如下命令,在a.bat里面把下面的内容单独储存在b.bat里面,本人菜鸟一枚。用echo一段一段来好像很不科学,有什么符号或者方法可以一次性将它们输入到一个文本里面吗?求大虾帮忙,感激不尽!!!
@echo off
echo This is the begin..
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp register=PRIMARY
netsh interface ip set wins name="本地连接" source=dhcp
echo This is the ending.. 展开
@echo off
echo This is the begin..
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp register=PRIMARY
netsh interface ip set wins name="本地连接" source=dhcp
echo This is the ending.. 展开
1个回答
展开全部
再怎么一次性你也要一段一段来啊!另外,你为什么会认为用echo就不是一次性的呢?事实证明用echo就是最简单、最有效、最科学的方法:
echo @echo off > c:\b.bat
echo echo This is the begin.. >> c:\b.bat
echo netsh interface ip set address name="本地连接" source=dhcp >> c:\b.bat
echo netsh interface ip set dns name="本地连接" source=dhcp register=PRIMARY >> c:\b.bat
echo netsh interface ip set wins name="本地连接" source=dhcp >> c:\b.bat
echo echo This is the ending.. >> c:\b.bat
echo @echo off > c:\b.bat
echo echo This is the begin.. >> c:\b.bat
echo netsh interface ip set address name="本地连接" source=dhcp >> c:\b.bat
echo netsh interface ip set dns name="本地连接" source=dhcp register=PRIMARY >> c:\b.bat
echo netsh interface ip set wins name="本地连接" source=dhcp >> c:\b.bat
echo echo This is the ending.. >> c:\b.bat
追问
哈哈,是太懒了所以.....
能不能有类似这样的方式的?
echo
(
@echo off
echo This is the begin..
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp register=PRIMARY
netsh interface ip set wins name="本地连接" source=dhcp
echo This is the ending..
)
>>b.bat
有没有这样的不???
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询