我想制作一个简单的批处理应用程序来做两件事。
以下是第一件事,但我无法从手指输出结果。
@ECHO OFF
:begin
echo Enter the name of the user you are looking for:
set INPUT=
set /P INPUT=Name: %=%
finger -l %INPUT%@mail.example.com
pause
GOTO begin
答案 0 :(得分:0)
这样的事可能。
@echo off
setlocal
set INTERVAL=10
echo Enter the name of the user you are looking for:
set /P INPUT=
echo INPUT=%INPUT%
echo Name: %INPUT%
:LOOP
for /F "usebackq tokens=*" %%a IN (`finger -l %INPUT%@mail.example.com`) DO set OUTPUT=%%a
echo OUTPUT=%OUTPUT%
if "%OUTPUT%"=="something" (goto LOOPEND)
call :SLEEP %INTERVAL%
goto LOOP
:LOOPEND
goto :eof
:: -------------- Sleep function -------------------
:SLEEP
set /a SECS=%1
set /a SECS+=1
ping 127.0.0.1 -n %SECS% -w 1000 > nul
goto :eof