
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (test2.tmp) do (
set /a n+=1
if !n! equ 1 (set O=%%i) else (set P=%%i)
)
echo.%O%
echo.%P%
pause
CODE: [Copy to clipboard][ Last edited by wewebb on 2010-11-17 at 21:35 ]Rem 类似数组的变量
@echo off & Setlocal EnableDelayedExpansion
for /f %%a in ('findstr ":" "%temp%\test2.tmp"') do (
set /a n+=1
set "Drv[!n!]=%%a"
)
echo 共有 !n! 个盘符。盘符变量分别保存在 Drv[1] --- Drv[!n!] 变量中
pause
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |