Estoy usando Windows 7 y me gustaría crear menús, barras de progreso, etc. con caracteres especiales como este. ¿Como hacer esto?
Respuesta1
El punto es que necesitas usar el formato UTF-8,echar un vistazo:
Paso 1] Cree un nuevo script CMD en formato "UTF 8". (Los editores de PsPad o Notepad++ pueden hacer esto)
Paso 2] Deje una línea en blanco vacía en la primera línea. El encabezado UTF 8 se almacena allí.
Paso 3] Copie y pegue el siguiente código:
@echo off
CHCP 65001
:: *****************************************************************************
:: * Author: Gustaaf von Pickartz. *
:: * Date Created: 22nd July, 2012. *
:: * ------------------------------------------------------------------------- *
:: * This program is provided as is and for fair use distribution. *
:: * Give credit where credit is due to the author in your own script. *
:: * ------------------------------------------------------------------------- *
:: *****************************************************************************
SETLOCAL ENABLEDELAYEDEXPANSION
:: Progress Bar
SET PRG0=[░░░░░░░░░░]
SET PRG1=[▓░░░░░░░░░]
SET PRG2=[▓▓░░░░░░░░]
SET PRG3=[▓▓▓░░░░░░░]
SET PRG4=[▓▓▓▓░░░░░░]
SET PRG5=[▓▓▓▓▓░░░░░]
SET PRG6=[▓▓▓▓▓▓░░░░]
SET PRG7=[▓▓▓▓▓▓▓░░░]
SET PRG8=[▓▓▓▓▓▓▓▓░░]
SET PRG9=[▓▓▓▓▓▓▓▓▓░]
SET PRG10=[▓▓▓▓▓▓▓▓▓▓]
:: Star
SET STR1=/
SET STR2=--
SET STR3=\
SET STR4=^|
:: Please note there are special ASCII insertions in the SET BKSPC= declaration below. 80x backspace characters are inserted. ASCII Value 08=[BS]
:: Be sure to verify they are still there when you cut and paste from the web with your text editor (Notepad++ or PsPad). Insert them if missing, otherwise this script will not work...
SET BKSPC=
:Begin_Main
echo.
echo.
Echo Simple Animated star.
FOR /L %%I IN (1,1,400) DO (
<NUL (SET/P Z= PROGRESS: │)
<NUL (SET/P Z=%BKSPC%)
<NUL (SET/P Z= PROGRESS: /)
<NUL (SET/P Z=%BKSPC%)
<NUL (SET/P Z= PROGRESS: ─)
<NUL (SET/P Z=%BKSPC%)
<NUL (SET/P Z= PROGRESS: \)
<NUL (SET/P Z=%BKSPC%)
)
echo.
echo.
Echo Simple Progress bar indicator
FOR /L %%I IN (0,1,10) DO (
IF %%I LEQ 9 (SET TIC=0%%I) ELSE (SET TIC=%%I)
<NUL (SET/P Z=[!TIC!/10] PROGRESS: !PRG%%I!)
>NUL PING -n 2 localhost
<NUL (SET/P Z=%BKSPC%)
)
echo.
echo.
Echo Combined Progress bar and animated star...
FOR /L %%I IN (0,1,10) DO (
IF %%I LEQ 9 (SET TIC=0%%I) ELSE (SET TIC=%%I)
<NUL (SET/P Z=[!TIC!/10] PROGRESS: !PRG%%I!)
<NUL (SET/P Z=%BKSPC%)
FOR /L %%J IN (1,1,400) DO (
<NUL (SET/P Z=[!TIC!/10] PROGRESS: !PRG%%I! │)
<NUL (SET/P Z=%BKSPC%)
<NUL (SET/P Z=[!TIC!/10] PROGRESS: !PRG%%I! /)
<NUL (SET/P Z=%BKSPC%)
<NUL (SET/P Z=[!TIC!/10] PROGRESS: !PRG%%I! ─)
<NUL (SET/P Z=%BKSPC%)
<NUL (SET/P Z=[!TIC!/10] PROGRESS: !PRG%%I! \)
<NUL (SET/P Z=%BKSPC%)
)
<NUL (SET/P Z=%BKSPC%)
)
Paso 4] Asegúrese de "insertar" caracteres ASCII de retroceso 80x en SET BKSPC= (http://columbia.edu/kermit/ascii.html)
Paso 5] Asegúrese de configurar la fuente de su consola CMD en la fuente True Type, no en la trama.