我已经尝试了好几天,似乎可以让它发挥作用。我找到了一个例子,但它使用了一个不起作用的(CryEcho)。我只是想添加它以让用户知道在 ping IP 地址时正在发生的事情。我确实在这里找到了一些代码,但这让我感到困惑,因为我刚刚开始为了好玩而搞乱批处理文件。
无论如何,我想要使用类似于下面示例的内容,但使用类似 (Waiting...[spinner]) 的文本。谢谢!
@echo off
setlocal
set COUNT=0
set MAXCOUNT=10
set SECONDS=1
:LOOP
title "\"
call :WAIT
title "|"
call :WAIT
title "/"
call :WAIT
title "-"
if /i "%COUNT%" equ "%MAXCOUNT%" goto :EXIT
set /a count+=1
echo %COUNT%
goto :LOOP
:WAIT
ping -n %SECONDS% 127.0.0.1 > nul
ping -n %SECONDS% 127.0.0.1 > nul
goto :EOF
:EXIT
title FIN!
endlocal
我也发现了这段代码:
@echo off
rem Example showing how to use CryEcho to produce a spinning wheel to show activity.
CryEcho Working ...
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
call :SpinAlive
call :DoSomeWork
cryecho \s\nFinished.
goto :eof
:DoSomeWork
ping -n 1 localhost > nul
goto :eof
:SpinAlive
if "%Spinner%" == "2" (cryecho \\\b)
if "%Spinner%" == "3" (cryecho -q "|"\b)
if "%Spinner%" == "4" (cryecho /\b set Spinner=0) else (cryecho -\b set Spinner=1)
set /A Spinner=%Spinner%+1
goto :eof