請問如下將下面的批處理簡化
當從DB-1~DB-10 這樣就要寫成好大一串
但是差別的只有檔案名稱與輸出的解果
謝謝!!
結果:
[ Last edited by XZ on 2008-7-24 at 09:51 PM ]
當從DB-1~DB-10 這樣就要寫成好大一串
但是差別的只有檔案名稱與輸出的解果
謝謝!!
set DB-1=DB-1-Chip.ini
set DB-2=DB-2-Display.ini
set DB-3=DB-2-Audio.ini
set DB-4=DB-4-.ini
set DB-5=DB-5-.ini
set DB-9=DB-9-Vendor.ini
echo.
SET xxxxx=%~dp0
set source=%xxxxx:~0,-1%
echo Source Path
echo %source%
pause
CALL :Processor-DB-1
CALL :Processor-DB-2
goto Zend
:Processor-DB-1
for /f "eol=# tokens=1,2,3* delims= usebackq" %%i in ( "%source%\9-DataBase\DB-1-Chip.ini" ) do (
set Match-DB-1-VDID=%%i
set Match-DB-1-Name=%%j
set Match-DB-1-Path=%%k
:: "%source%\devcon" find pci\* | find /i "%%i" && goto Match-DB-2
reg query HKLM\SYSTEM\CurrentControlSet\Enum\PCI | find /i "%%i" >nul 2>nul && goto Match-DB-1
)
echo Sorry !!
echo No match chip is DB-1-Chip!
goto :eof
:Match-DB-1
echo Chip is
echo %Match-DB-1-VDID:~0,8%^&%Match-DB-1-VDID:~-9%
echo %Match-DB-1-Name%
echo %Match-DB-1-Path%
echo.
goto :eof
:Processor-DB-2
for /f "eol=# tokens=1,2,3* delims= usebackq" %%i in ( "%source%\9-DataBase\DB-2-Display.ini" ) do (
set Match-DB-2-VDID=%%i
set Match-DB-2-Name=%%j
set Match-DB-2-Path=%%k
:: "%source%\devcon" find pci\* | find /i "%%i" && goto Match-DB-2
reg query HKLM\SYSTEM\CurrentControlSet\Enum\PCI | find /i "%%i" >nul 2>nul && goto Match-DB-2
)
goto :eof
:Match-DB-2
echo Display is
echo %Match-DB-2-VDID:~0,8%^&%Match-DB-2-VDID:~-9%
echo %Match-DB-2-Name%
echo %Match-DB-2-Path%
echo.
goto :eof
:Zend
pause
結果:
Source Path
\\127.0.0.1\新資料夾\asdf 123\qwer 456
請按任意鍵繼續 . . .
Chip is
VEN_8086&DEV_27DF
Intel Chip 7
\INTEL\Chip\7Setup.exe
Display is
VEN_1002&DEV_9589
ATI Radeon HD 900 PRO
\ATI\2600PRo\9Setup.exe
請按任意鍵繼續 . . .
[ Last edited by XZ on 2008-7-24 at 09:51 PM ]
