回复 4# enpany
仅 Win 10 有效
来个简单特效- @echo off & setlocal enabledelayedexpansion
- REM VT100 参考
- REM https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
-
- for /F %%a in ('echo prompt $E^| cmd') do set "_ESC=%%a"
-
- REM 窗口尺寸也可以不指定
- mode 100,40
-
- REM 移动周期: 正整数, 越小, 移动越快
- set /a "cycle=2000"
-
- set "rgb_red=%_ESC%[38;2;255;0;0m"
- set "rgb_grn=%_ESC%[38;2;0;255;0m"
- set "rgb_blu=%_ESC%[38;2;0;0;255m"
- REM set "str=bbs.bathome.net"
- set "str=%rgb_red%bbs.%rgb_grn%bathome%rgb_blu%.net"
- set "str_clear=%rgb_red%bbs.%rgb_grn% %rgb_blu%.net"
-
- for /f "tokens=3,4 delims=, " %%A in (
- 'powershell -command "&{$H=get-host;$H.ui.rawui;}"^|findstr /b WindowSize'
- ) do set /a "_win_wid=%%A, _win_hei=%%B, x_ubound=_win_wid-14" & REM 14 为 str 的长度 - 1
-
- set /a "y= !random! %% _win_hei + 1, x= !random! %% x_ubound + 1"
- set /a "dx=dy=1"
-
- REM 隐藏光标 Hide the cursor
- <nul set /p "=%_ESC%[?25l"
-
- for /l %%a in (-9999999 1 9999999) do (
- set /a "m=%%a %% cycle"
- if !m!==0 (
- <nul set /p "=%_ESC%[!y!;!x!H%str_clear%"
-
- if !y! geq !_win_hei! set /a "dy=-1"
- if !y! leq 1 set /a "dy=1"
- if !x! geq !x_ubound! set /a "dx=-1"
- if !x! leq 1 set /a "dx=1"
- set /a "y+=dy,x+=dx"
- <nul set /p "=%_ESC%[!y!;!x!H%str%"
- )
- )
复制代码
|