BAT read file and write file

阅读更多
@echo off
setlocal enableextensions
setlocal enabledelayedexpansion
for /f "tokens=1 delims= " %%m in (sys.out) do (
	set num=%%m
	if /i !num! equ 5 (            
		echo 1 >nsys.out
		del sys.out && move nsys.out sys.out
	) else (
		set old=%%m
		set /a newN=!old!+1
		echo !newN! >nsys.out
		del sys.out && move nsys.out sys.out
	) 
)

你可能感兴趣的:(bat)