标题: [特效代码] [已解决]bat实现全彩字符 [打印本页]
作者: LJY4.0 时间: 2022-12-16 22:23 标题: [已解决]bat实现全彩字符
本帖最后由 LJY4.0 于 2022-12-17 14:35 编辑
用bat或外部工具实现:
123
这样的效果
颜色可以像color这样可以调节
作者: 77七 时间: 2022-12-16 23:11
本帖最后由 77七 于 2022-12-16 23:20 编辑
- @echo off
- echox -n -c 01 1
- echox -n -c 02 2
- echox -c 03 3
- pause
复制代码
echox可以,就是麻烦,得写三行
作者: ANSL 时间: 2022-12-17 11:48
本帖最后由 ANSL 于 2022-12-17 12:27 编辑
回复 1# LJY4.0
方便,"简单",不使用三方工具
但是只能显示少数颜色
利用了Findstr的特性!- @echo off
- chcp 936 > nul
- echo.
- echo.正在加载图形引擎...
- If "%1"=="" (
- for %%a in ( QuickEdit:00000000
- CodePage:000003a8
- ColorTable00:000c0c0c
- ColorTable01:00da3700
- ColorTable02:000ea113
- ColorTable03:00dd963a
- ColorTable04:001f0fc5
- ColorTable05:00981788
- ColorTable06:00009cc1
- ColorTable07:00cccccc
- ColorTable08:00767676
- ColorTable09:00ff783b
- ColorTable10:000cc616
- ColorTable11:00d6d661
- ColorTable12:005648e7
- ColorTable13:009e00b4
- ColorTable14:00a5f1f9
- ColorTable15:00f2f2f2
- ) do For /F "tokens=1,2 delims=:" %%b in ("%%a") do (
- >nul Reg add HKCU\Console\Colors /v %%b /t reg_dword /d 0x%%c /f
- )
- Start "Colors" "%ComSpec%" /c "%~s0" 1&Goto:eof
-
- ) Else ( >nul reg delete HKCU\Console\Colors /f )
- @goto INSTALL_COLOR
-
- :INSTALL_COLOR
- (
- echo.@echo off
- echo.chcp 936 ^> nul
- echo.Setlocal EnableDelayedExpansion
- echo.REM setlocal enableextensions
- echo.set dstdir=C:\tmpColorDirtoDelete
- echo.IF EXIST %%dstdir%% goto errExist
- echo.@mkdir %%dstdir%%
- echo.@cd %%dstdir%%
- echo.set count=0
- echo.REM DEFINISCO IL CARATTERE BACKSPACE!
- echo.set "$Defines=$BS" & set "$Details=Create $ESC Ascii-0x1B-27, Expansion insensitive"
- echo. for /f "delims=#" %%%%a in ^(
- echo. '"prompt #$H# &echo on &for %%%%b in (1) do rem"'
- echo. ^) do ^(
- echo. set "%%$Defines%%=%%%%a"
- echo. set "%%$Defines%%=!$BS:~0,1!"
- echo. ^)
- echo.FOR %%%%a IN ^(%%*^) DO ^(
- echo. FOR /F "usebackq delims=# tokens=1,*" %%%%b IN ^('%%%%a'^) DO ^(
- echo. REM echo %%%%b sara' di colore %%%%c
- echo. set /A count=!count!+1
- echo. set nomefile=%%%%b
- echo. IF %%%%c.==. ^(
- echo. set colore=03
- echo. ^) ELSE ^(
- echo. set colore=%%%%c
- echo. ^)
- echo. REM SET /P ".=" %%%%b
- echo. SET /P ".=%%$BS%% " ^<nul ^>%%%%b
- echo. REM echo !count!^>%%%%b
- echo. REM echo FINDSTR /A:%%%%c /C:"!count!" /S "%%%%b"
- echo. REM more %%%%b
- echo. set bin=%%%%b
- echo. ^)
- echo. REM FINE INNER FOR
- echo. REM echo FINDSTR /A:!colore! /C:"!count!" /S "!nomefile!"
- echo. FINDSTR /A:!colore! /C:" " /S "!nomefile!"
- echo. REM goto end
- echo.^)
- echo.REM FINE OUTER FOR
- echo.echo.
- echo.REM ERROR HANDLING
- echo.goto chiusura
- echo.:errExist
- echo.echo 临时目录%%dstdir%%已存在.在继续或更改批处理中的路径之前将其删除.
- echo.goto pulizia
- echo.:chiusura
- echo.:pulizia
- echo.cd..
- echo.rd /S /Q %%dstdir%%
- echo.goto end
- echo.:end
- ) > color.bat
- SetLocal EnableDelayedExpansion
- rem 从这开始调用
- call color.bat 1#0c 2#72 3#08
- goto :end
- :end
- echo 执行完毕...
- pause>nul
- exit/b 0
复制代码
作者: LJY4.0 时间: 2022-12-17 14:35
谢谢上面两位大神,不过我打算用二楼的方法,稍微改了一下,xecho多是多,但一下显示一串字符还得搭配另外的,变量延迟没学精通
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |