算是完成功能了,但我还是不太满意,看看其他高人的。
看有没办法不生成临时文件 temp.reg ,有没办法不使用额外的中间变量 skipline 。
为了确保不出错,用的方法是:定位 所在行,然后从它的下一行取。
@echo off
reg EXport HKLM\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046} temp.reg >nul
for /f "delims=" %%i in ('find/n "" temp.reg') do set skipline=%%i
for /f "skip=%skipline% tokens=2 delims==" %%a in ('type temp.reg') do ( echo %%~a & GOTO OUT )
:OUT
del temp.reg
pause>nul
Last edited by NaturalJ0 on 2006-10-19 at 23:12 ]
It's considered that the function is completed, but I'm still not completely satisfied. Let's see what other experts have.
See if there's a way to not generate the temporary file temp.reg and a way to not use the extra intermediate variable skipline.
To ensure no mistakes, the method used is: locate the line where is, and then take from the next line of it.
@echo off
reg EXport HKLM\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046} temp.reg >nul
for /f "delims=" %%i in ('find/n "" temp.reg') do set skipline=%%i
for /f "skip=%skipline% tokens=2 delims==" %%a in ('type temp.reg') do ( echo %%~a & GOTO OUT )
:OUT
del temp.reg
pause>nul
Last edited by NaturalJ0 on 2006-10-19 at 23:12 ]