回复 31# cpp
假设总文件夹在 D:\123\ (执行时自行修改)
另grads 程序不在D:\123\ 下 那么应该给出路径
前面代码 一并修改- @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"
- )
- pause
复制代码
|