本帖最后由 terse 于 2012-3-20 22:59 编辑
按一楼新要求 修改 不保证代码的通用行 运行代码前 请先备份总文件夹下的所有文件 | @echo off&setlocal enabledelayedexpansion | | set "ph=d:\123\" | | cd /d "%ph%" | | for /f "tokens=*" %%i in ('dir /s /b /a-d "%ph%*.ctl"') do ( | | for /f "usebackq tokens=1,2" %%j in ("%%~i") do if /i "%%j"=="tdef" set "N=%%k" | | (for /f "usebackq tokens=*" %%j in ("cp.gs") do ( | | set "Str=%%j" | | if "%%~xj" neq ".ctl'" ( | | if "!str:~,9!" neq "while(i<=" ( | | if "!str:~,9!" equ "'printim " (echo 'printim %%~dpi%%~nxj)else echo %%j | | ) else echo while^(i^<=!N!^) | | ) else echo 'open %%i' | | ))>"~temp.mp" | | move "~temp.mp" "%ph%cp.gs" | | grads -blc "%ph%cp.gs" | | ) | | pauseCOPY |
|