China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 09:09
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Question 2: How to correspond each key of the common keyboard to a variable? View 2,176 Replies 1
Original Poster Posted 2021-08-03 14:46 ·  中国 海南 海口 移动
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Suppose there is a batch processing simulation of an information-state toy generalized Chinese character programming computer,
and suppose it is composed of three components:
1. Display output batch processing
2. Keyboard input batch processing
3. Body batch processing for binary access storage dictionary operation
(Concepts are infinite: time, space, dimensional space, Tai Chi set characters, dot matrix. All time-space text, line processing information point cutting)

Question 2:
How to correspond the keyboard keys of the existing hardware computer to variables, and then translate them into program characters for output execution?
(The array is composed of Heavenly Stems Jia Yi Bing, Yi Er San, Yi Er San, 123. On the basis of establishing the standard replacement of existing computer information, consider expanding the ordinary characters and extraordinary derived ranges of Chinese characters)
For example
ctrl = Lu 1 (space in the first column of the sixth row of the keyboard)
space = Lu 4
(The commands of batch processing should be as simple as possible, and the purpose of simplicity is to facilitate the learning and understanding of laypeople, and set and if are packaged as Chinese characters)
(It can also be a chat discussion post)

@echo off
setlocal enabledelayedexpansion
mode con cols=100 lines=25
for /f "skip=11" %%i in (%~fs0) do (
set a=%%i
set a=!a:1=type!
set a=!a:0= !
set a=!a:2=2.txt!
echo !a!
)
pause>nul
102

[ Last edited by zzz19760225 on 2021-8-10 at 23:17 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 2 Posted 2021-08-18 11:46 ·  中国 海南 海口 移动
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
1. Create screen file, screen.bat
----------------------------------------------
@echo off
setlocal enabledelayedexpansion
title Screen
:0
for /f %%i in ('type 显存.txt') do (
set a=%%i
set a=!a:1=□!
set a=!a:2=▉!
echo !a!
)
ping -n 5 127.0.0.1>nul
cls
goto 0
----------------------------------------------
2. Create video memory file, video_memory.txt

3. Create 12-base element binary input keyboard, keyboard12.bat
----------------------------------------------
@echo off
title Keyboard 12
:1
set /p a=:
set /p b=<video_memory.txt
echo %b%%a%>video_memory.txt
goto 1
----------------------------------------------

May I ask how to implement line breaks on the screen with this batch script?
1<词>,2,3/段\,4{节},5(章)。
Forum Jump: