Board logo

标题: [已解决]关于FOR命令的一些问题请求帮助 [打印本页]

作者: clear700     时间: 2007-7-5 05:25    标题: [已解决]关于FOR命令的一些问题请求帮助

我找一个批处理文件内容如下
Set flag=
dmi.exe /f

:check
If Not Exist DMIINFO.TXT Goto check
chcp 936>nul
For /f "tokens=2 delims==" %%i In ('findstr /bi "Product_Name" DMIINFO.TXT') do set type=%%i
Echo          你的型号是:%type% 系统正在分配驱动
ping -n 6 %computername%>nul
Set type=%type:*-=%
For /l %%i In (1,1,9) Do If "%type:~1,1%"=="%%i" Set type=%type:~0,2%
For /f "delims=" %%i In ('dir /a-d /b "*%type:~0,3%*.txt" 2^>nul') do (
    Set flag=1
    For /f "delims=" %%j In ('dir /ad /b^|findstr /ivx /g:"%%i" 2^>nul') do rd /q /s "%%j" 2>nul
)
Del /f /q *.txt 2>nul
If Not defined flag (
    For /d %%i In (*) Do rd /q /s "%%i" 2>nul
    Echo          无法找到符合%type%笔记本的驱动
    Echo          此窗口20秒后自动退出
    ping -n 20 %computername%>nul
)
Del "%~0"
pause

我不是很清楚 For /f "tokens=2 delims==" %%i In ('findstr /bi "Product_Name" DMIINFO.TXT') do set type=%%i
这一行里的意思。
如果我想修改。从INFO.txt里取得一个信息怎么修改
INFO.txt的内容是如下我用红色表表示我要取得的内容
哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪[compiled@15.03.2004]哪?
  BIOS Info Tool v1.3,          Copyright(c) 2004 by Serge Galkin (StarGaz0r)
  Win9x/Win2k/XP version                              e-mail: stargaz0r@nm.ru
屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯

?ROM BIOS by American Megatrends Inc., 02/05/07
   BIOS ID String: ??
   Version: ?  release date: //

?DMI.BaseBoardInformation:
    Manufacturer: Sony Corporation
    Product: VAIO
    Version: N/A
    Serial Number: N/A

?DMI.SystemInformation:
    Manufacturer: Sony Corporation
    Product Name: VGN-FE770G
    Version: C3LMMYGJ
    Serial Number: 28247830-3012552

?DMI.BIOSInformation:
    Vendor Name: Phoenix Technologies LTD
    BIOS Version: R0200J3
    BIOS Starting Address Segment: E6B3h
    BIOS Release Date: 02/05/2007
    BIOS ROM Size: 1024 KB

?Supported features:
    [鸧 PTLTD ACPI 0.9/1.x
    [鸧 System Management BIOS w/DMI v2.40
    [鸧 PCI IRQ Routing Table v1.0 (incorrect!)

?Add-on BIOS detected:
    Intel Corp.  
      Located @C50000
      Init Entry Point @C5E45F
      Size 64kb

[ Last edited by clear700 on 2007-7-5 at 03:10 PM ]
作者: Climbing     时间: 2007-7-5 09:01
多看看老帖子,对照着for /?学习。
作者: clear700     时间: 2007-7-5 12:59
看的头都晕了
我把这行改了怎么就不工作呢?
For /f "tokens=2 delims==" %%i In ('findstr /bi "Product Name" DMIINFO.TXT') do set type=%%i


Product Name这个原先有_ 下滑线  我改成没有就不正常工作了?还有我要提取的东西和先前写这个DAT的人的东西不太一样
他先前的是DMIINFO.TXT是如下


Manufacturer_Name(Type1,Offset04h)  = Compal
Product_Name(Type1,Offset05h)  = CL51
Version(Type1,Offset06h)       =
Serial_Number(Type1,Offset07h) =
作者: lxmxn     时间: 2007-7-5 13:25

@echo off
for /f "delims=: tokens=2" %%a in ('findstr /ic:"Product Name" procude.txt') do echo 要提取的信息:%%a
pause

作者: clear700     时间: 2007-7-5 15:22
已经搞定了非常感谢~