- ::pushd A 这个A是要处理的文件夹。如果路径中有空格要加引号。比如"E:\E:\Users\Canyue\Te st"
- @echo off & setlocal enabledelayedexpansion
- set "now=%cd%" & pushd A || exit
- set "cline=LUNO;NETNO;HostPortNo0;IP-Address;Subnet-Mask;Default-Gateway"
- set temp=%cline:IP-Address=IP%
- set temp=%temp:Subnet-Mask=子网掩码%
- set temp=%temp:Default-Gateway=网关%
- echo %temp:;=,%,处理器频率 > "%now%\a.csv"
- for /f "tokens=* delims=" %%f in ('dir /b /a-d *.txt') do (call :findc "%%f") >> "%now%\a.csv"
- echo 所有完成。
- pause>nul
- exit
-
- :findc
- setlocal
- for %%i in (%cline%) do (
- set "cfind=%%i" & set "cfind=!cfind:-= !"
- for /f "skip=2 tokens=2 delims==,:" %%j in ('find "!cfind!" "%~1"') do set %%i=%%~j
- )
- for %%i in (%cline%) do call set /p=%%%%i%%,<nul
- for /f "skip=2 tokens=1 delims=[]: " %%i in ('find /n "处理器:" "%~1"') do set line=%%i
- for /f "skip=%line% tokens=2 delims=: usebackq" %%i in ("%~1") do if not defined v echo %%i & set v=b
- endlocal
- goto :eof
复制代码
|