回复 tmplinshi
感謝, 能用了
有一個問題, 請問能不指定檔名, 而是更改資料夾內所有 txt ...
nickl 发表于 2013-1-3 11:14 - @echo off
- setlocal enabledelayedexpansion
-
- for %%a in (*.txt) do (
- set file="%%a"
-
- for /f "tokens=*" %%a in (' more !file! ') do (
- set str=%%a
-
- for %%i in (SUP Number Location) do (
- set str=!str:*%%i=%%i!
- set str=!str: =!
-
- if "!str:%%i:=!" neq "!str!" (
- set %%i=!str:*:=!
- )
- )
-
- )
-
- ren !file! !SUP!_!Number!_!Location!.txt
- )
复制代码
|