中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 11:53
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Question 2: How to correspond each key of the common keyboard to a variable?
Printable Version  2,369 / 1
Floor1 zzz19760225 Posted 2021-08-03 14:46
超级版主 Posts 2,020 Credits 3,673
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 ]
Floor2 zzz19760225 Posted 2021-08-18 11:46
超级版主 Posts 2,020 Credits 3,673
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?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023