我创建了一个简单的批处理文件来重新组织一组文件/文件夹。它应该工作,但我需要将结果打印到日志文件,现在,我无法阻止它,请帮助我。
@echo off
cls
del/f c:\SWSETUP\info.txt
systeminfo.exe >>c:\SWSETUP\info.txt
find /i "System Model:" c:\SWSETUP\info.txt
find /i "OS Version" c:\SWSETUP\info.txt
del/f c:\SWSETUP\log.txt
netsh mbn show interfaces >> c:\SWSETUP\log.txt
find /i "Model" c:\SWSETUP\log.txt
find /i "Firmware Version" c:\SWSETUP\log.txt
test.bat >> result.txt
@GOTO :EOF
答案 0 :(得分:0)
如果您的批处理文件被称为test.bat
,则它在
test.bat >> result.txt
所以永远不会结束。试试像
这样的东西@echo off
>"info.txt" systeminfo.exe
>"log.txt" netsh mbn show interfaces
>"result.txt" (
findstr /l /i /c:"System Model:" /c:"OS Version" "info.txt"
findstr /l /i /c:"Model" /c:"Firmware Version" "log.txt"
)
或者,如果不需要info.txt
和log.txt
,只有result.txt
,您可以使用
@echo off
>"result.txt" (
systeminfo.exe | findstr /l /i /c:"System Model:" /c:"OS Version"
netsh mbn show interfaces | findstr /l /i /c:"Model" /c:"Firmware Version"
)