本帖最后由 pcl_test 于 2015-2-25 20:50 编辑
回复 1# binghejin
假设有文本文件test.txt- @echo off
- if not exist *.t (
- for /f "skip=1 tokens=3" %%t in ('dir "test.txt" ^|find ":"') do cd.>"%%t.t"
- )
- for /f "delims=" %%i in ('type "test.txt"') do set "str1=%%i"
- echo,尾行内容为:%str1%
- ping 0 -n 2 >nul 2>nul
- cls
- :begin
- for /f %%j in ('dir /b *.t') do set "name=%%~nj"
- for /f "skip=1 tokens=3" %%a in ('dir "test.txt" ^|find ":"') do set "size=%%a"
- if not "%name%" == "%size%" (
- for /f "delims=" %%j in ('type "test.txt"') do set "str2=%%j"
- ren "%name%.t" "%size%.t"
- call echo,尾行内容为:%%str2%%
- echo 更新于%time:~0,8%
- echo 按任意键后将继续监测文本更新情况……
- pause >nul
- cls
- ) else (
- echo 等待更新中……
- ping 0 -n 2 >nul 2>nul
- cls
- )
- goto begin
复制代码
|