中国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-08-10 14:58
47,811 topics / 349,897 posts / today 0 new / 48,255 members
DOS批处理 & 脚本技术(批处理室) » How to implement option content where the numbers are obtained from a text file
Printable Version  3,374 / 8
Floor1 andred0421 Posted 2006-12-13 09:46
初级用户 Posts 47 Credits 114
echo ╭────────╮
echo ╭─────┤ Options ├─────────╮
echo │ ╰────────╯ │
echo │ 1. ++++++++ │
echo │ │
echo │ 2. fdfdfd │
echo │ │
echo │ 3. gfgfg │
echo │ │
echo ╰──────────────────────────╯
echo.

How to implement the option content, where the numbers are obtained from a text file in the same directory,

The text file format:

1. ++++++++
2. fdfdfd
3. gfgfg
Floor2 lxmxn Posted 2006-12-13 10:08
版主 Posts 4,938 Credits 11,386
It can be achieved, but after reading, it is not necessarily guaranteed to be a rectangular box.
Floor3 redtek Posted 2006-12-13 11:30
金牌会员 Posts 1,147 Credits 2,902
```
@echo %dbg% off && setlocal enabledelayedexpansion

:: Total length: 60
:: Menu offset: 18
:: Extraction: ~0,59 (last character filled with "│" character)
:: Formula: fill with │


set "space= "
set "vol= │ "
echo ╭────────╮
echo ╭─────┤ Options ├─────────╮
echo │ ╰────────╯ │

for /f "tokens=1* delims=" %%i in (menu.txt) do (
set a=%vol%%%i%space%
echo !a:~0,59!│
echo │ │
)
echo │ │
echo │ │
echo │ │
echo ╰────────────────────────╯
echo.

```

The pasted format looks messy. The completed source code and menu file are compressed into an attachment and uploaded, which is convenient for the landlord to debug: )

Attachments
menu.rar (506 bytes)
Floor4 lxmxn Posted 2006-12-14 00:51
版主 Posts 4,938 Credits 11,386

  Brother Redtek wrote wonderfully. Add points~~
Floor5 ccwan Posted 2006-12-14 00:53
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Protest! I am too restricted in adding points.
Floor6 无奈何 Posted 2006-12-14 02:32
荣誉版主 Posts 356 Credits 1,338
RE redtek 兄
When posting, selecting the font "SimSun" can achieve monospacing display.
Floor7 HUNRYBECKY Posted 2006-12-14 05:07
银牌会员 Posts 442 Credits 1,179
Originally posted by redtek at 2006-12-13 11:30:
Floor8 zh159 Posted 2006-12-14 05:24
金牌会员 Posts 1,467 Credits 3,687
For the content containing Chinese characters, using the above method will result in the final "|" character being misaligned. So it is best to calculate the number of bytes.

[ Last edited by zh159 on 2006-12-13 at 04:25 PM ]
Floor9 zhangqing1123 Posted 2008-06-01 10:14
新手上路 Posts 1 Credits 2
Nice
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023