我需要一个可以获取此文本文件的批处理脚本:
Set Date=2015-10-20 Set Time=18:05:47.47 Set Ipw=%ipwan% Set loc=%Location% Set Img=%ImgName%.bmp
然后把它变成这个:
Set Date=2015-10-20
Set Time=18:05:47.47
Set Ipw=%ipwan%
Set loc=%Location%
Set Img=%ImgName%.bmp
任何想法? TIA
答案 0 :(得分:1)
@echo off
setlocal EnableDelayedExpansion
rem Create a variable with CR+LF
for /F %%a in ('copy /Z "%~F0" NUL') do set NL=%%a^
%Empty line 1/2%
%Empty line 2/2%
rem Read the line from file
set /P "line=" < file.txt
rem Change " Set" by "CR+LF+Set"
echo %line: Set=!NL!Set%> file.txt
答案 1 :(得分:0)
FOR /F "tokens=1-10 delims= " %%A IN (file.txt) do (
echo %%A %%B
echo %%C %%D
echo %%E %%F
echo %%G %%H
)>newfile.txt