批处理的一个问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 04:49:00
把一条语句的结果或相关内容写入一个记事本:
如:ipconfig/all>d:\ipmax.txt
但是如果我要把多条语句的执行结果写入同一个记事本该怎么写?
是不是只能一对一?
如:if no exist d:\XXX goto 111
@echo xxxxxxxxxx>123.txt
:111
if not exist e:\hhh goto 222
@echo yyyyyyyyyy>123.txt
:222
.....
我要把多个语句的执行结果写入同一个文本,但是总是不行,都只能写入一个执行结果。求教大虾说下该怎么写?

>符号代表 覆盖原文件内容
>>符号叫重定向 意识是不覆盖原文件内容,将新的内容写在原文件内容的下面.

ipconfig/all > d:\ipmax1.txt
ipconfig/all > d:\ipmax2.txt
copy ipmax1.txt + ipmax2.txt ipmax.txt
del ipmax1.txt
del ipmax2.txt

ipconfig/all >> d:\ipmax.txt
ipconfig/all >> d:\ipmax.txt
这样就可以了