批处理

2017-04-21  本文已影响0人  养猫的老鼠
批处理提取文件中的"Station ID"内容,根据其不同创建相应的目录,并将相应内容拷贝至相应的目录下

@echo off
setlocal enabledelayedexpansion
del STATION.txt
echo "STATION ID" > STATION.txt
for %%j in (.log) do (
for /f "tokens=2 delims=:" %%a in ('findstr "StationID" > %%j 1>nul') do (
set str_0=%%a
)
rem echo !str_0!
findstr "!str_0!" STATION.txt 1>nul
if !errorlevel! neq 0 (
for %%g in (
.log) do (
findstr "!str_0!" %%g
if !errorlevel! equ 0 (
mkdir !str_0! 2>nul
copy /Y %%g !str_0! 1> nul
)
)
echo !str_0! >> STATION.txt )
)

上一篇下一篇

猜你喜欢

热点阅读