请大家分别测试以下三段代码:
::一:
@echo off
color f2
set n=0
:cir
rem wmic process call create cmd
echo %cd% %cmdcmdline%
set /a n+=1
if %n%==16 (
set /p m=Please choose:
if /i "%m%" equ "y" ( exit/B
) else ( msg console /time:2 "继续循环下去"&goto cir )
) else goto cir
::二
@echo off
set n=0
for /l %%i in (1,1,26) do call :cir %%i
goto :eof
:end
pause
goto :eof
:cir
echo.
set /p= %random:~1% <nul
set /a n+=1
if %n%==16 (
set /p m=Please choose 'y' to exit,or press 'n' go on:
if "%m%" equ "y" ( ::goto :eof
::exit /b
call :end
) else ( msg console /time:2 "继续循环下去"&goto cir )
) else ( rem 如果n等于19便退出程序。
if %n% equ 19 exit
goto cir
)
goto :eof
::三
@echo off
set n=0
set m=
pause
:cir
echo.
set /P= %random% <nul
set /a n+=1
if %n%==16 (
set /p=%0<nul
if defined m (echo INit............&pause
) else echo\&echo Over...........................&echo.&pause
) else goto cir
[ Last edited by learner0 on 2008-4-24 at 03:07 PM ]
::一:
@echo off
color f2
set n=0
:cir
rem wmic process call create cmd
echo %cd% %cmdcmdline%
set /a n+=1
if %n%==16 (
set /p m=Please choose:
if /i "%m%" equ "y" ( exit/B
) else ( msg console /time:2 "继续循环下去"&goto cir )
) else goto cir
::二
@echo off
set n=0
for /l %%i in (1,1,26) do call :cir %%i
goto :eof
:end
pause
goto :eof
:cir
echo.
set /p= %random:~1% <nul
set /a n+=1
if %n%==16 (
set /p m=Please choose 'y' to exit,or press 'n' go on:
if "%m%" equ "y" ( ::goto :eof
::exit /b
call :end
) else ( msg console /time:2 "继续循环下去"&goto cir )
) else ( rem 如果n等于19便退出程序。
if %n% equ 19 exit
goto cir
)
goto :eof
::三
@echo off
set n=0
set m=
pause
:cir
echo.
set /P= %random% <nul
set /a n+=1
if %n%==16 (
set /p=%0<nul
if defined m (echo INit............&pause
) else echo\&echo Over...........................&echo.&pause
) else goto cir
[ Last edited by learner0 on 2008-4-24 at 03:07 PM ]
