本帖最后由 terse 于 2013-7-5 17:39 编辑
回复 15# lateol
帮你整合在一起试吧
里面有重复处理 影响效率 看你的处理量了- @echo off
- cls
- for /l %%i in (1,1,3) do echo.
- color 1A
- ECHO ┏━━━━━━━━━━━━━━━━━━━━┓
- ECHO ┃ ┃
- ECHO ┏━━━━┫ 当前选择: 有规则程序自动合成 ┣━━━━┓
- ECHO ┃ ┃ ┃ ┃
- ECHO ┃ ┗━━━━━━━━━━━━━━━━━━━━┛ ┃
- echo ┃ ==处理说明↓== ┃
- echo. ┃ ┃
- ECHO ┃ ┗━━直接按回车默认选择“==NC==”文件夹处理━━┛ ┃
- echo. ┃ ┃
- echo. ┏------------------------------------------------------------┓
- echo ┣ ★★★★★★====默认选择==NC==处理。====★★★★★★ ┫
- echo. ┗------------------------------------------------------------┛
- echo. ┃ ┃
- echo. ┣= 请保证该所有程序内刀具无重复即可完成处理= 【0查看说明】 ┫
- echo. ┃ ┃
- set /p DJFL=
- IF /I '%DJFL%'=='0' GOTO zdhcsm
- echo ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
- echo ┃ ===正在处理...以下为刀具信息!==== ┃
- pushd "==NC==\"
- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=1,2* delims=:" %%i in ('findstr /ic:"TOOL NAME = " /c:"(Cutter Name:" /c:"( DIA. = " /c:"( Dia:" /c:"(Tool Name:" *.nc') do (
- if "!%%i!" == "" (
- set "str="
- if "%%k" == "" for /f "tokens=2-6 delims==,)" %%a in ("%%j") do (
- if "%%c" =="" (
- set D=%%a&set "R=%%b"
- ) else set D=%%c&set "R=%%e"
- ) else for /f "tokens=1-6 delims=:) " %%a in ("%%k") do (
- if "%%d" neq "" (
- set D=%%a&set "R=%%d"
- ) else set "str=%%a"
- )
-
- if "!str!" == "" for %%f in (D R) do for /f %%h in ("!%%f!") do (
- set "%%f=%%h"
- for /l %%e in (1 1 6) do (
- if "!%%f:~-1!" == "0" set "%%f=!%%f:~,-1!"
- )
-
- if "!%%f!" neq "0." (
- if "!%%f:~-1!" == "." set "%%f=!%%f:~,-1!"
- if "!%%f!" neq "" set "%%f=%%f!%%f!"
- ) else set "%%f="
- set "str=!D!!R!"
- )
- ::==========================修正DxRx==========================
- set strD=!str:~0,1!
- if "!strD!" equ "R" (
- for /f "tokens=1 delims=R" %%h in ("!str!") do set /a strJS=%%h*"2"
- set str=D!strJS!!str!
- )
- ::==========================此为按规则合并参数========================
- md "!str!" 2>nul
- set "f=%%~ni"
- set "f=!f:~-2!"
- set "s=-G"
- for %%a in (A R1 F1 -1) do if "!f:%%a=!" neq "!f!" set "s="
- (
- for /f "tokens=* delims=:" %%l in ('findstr /ic:G54.1P %%i') do (
- if not defined %%i-!str!!s! (
- set "var=%%l"
- for /f "delims=G " %%l in ("!var:*G54.1P=!") do (
- set "var= %%l"
- echo !var:~-2! %%i
- set %%i-!str!!s!=i
- )
- )
- )
- )>>"1-!str!!s!.lat"
- >$.t sort <"1-!str!!s!.lat"
- move $.t "1-!str!!s!.lat"
- )
- )
-
- echo ┠──────────────────────────────┨
- echo ┃ ===【刀具分类模拟完成!】=== ┃
- ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
- pause
复制代码
|