本帖最后由 13917134 于 2017-3-16 10:11 编辑
回复 6# GNU
文件路径是这样的
X:\Logs\Traceability Version 2\2017\01 - 一月\Final OP10-1\*.txt
我把文件放在logs文件夹里运行。- C:\Users\sz6vjc\Desktop\txt\Logs>锘縮etlocal enabledelayedexpansion
- '锘縮etlocal' is not recognized as an internal or external command,
- operable program or batch file.
-
- C:\Users\sz6vjc\Desktop\txt\Logs>(for /F "delims=" %a in ('dir /b /s /a-d *.txt'
- ) do (for /F "delims=" %i in ('findstr "[0-9]ms" "%a"') do (
- set "str=%i"
- set "str=!str:* in =!"
- set "str=!str:~0,-4!"
- echo,!str!
- ) ) ) 1>"C:\Users\sz6vjc\Desktop\txt\Logs\2.txt"
-
- C:\Users\sz6vjc\Desktop\txt\Logs>pause
- Press any key to continue . . .
复制代码 2.txt里面不是数字。是以下部分- C:\Users\sz6vjc\Desktop\txt\Logs>(for /F "delims=" %i in ('findstr "[0-9]ms" "C:\Users\sz6vjc\Desktop\txt\Logs\Traceability Version 2\2017\01 - 一月\Final OP10-1\2017-01-21 - Final OP10-1 Log.txt"') do (
- set "str=%i"
- set "str=!str:* in =!"
- set "str=!str:~0,-4!"
- echo,!str!
- ) )
复制代码 好像没有成功 |