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-06-20 20:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » P menu creation program View 12,277 Replies 76
Original Poster Posted 2006-12-24 05:20 ·  中国 北京 联通
银牌会员
★★★
努力做坏人
Credits 1,185
Posts 438
Joined 2006-08-28 12:00
19-year member
UID 61449
From 北京
Status Offline
Code released:
@echo off&setlocal enabledelayedexpansion&title P menu creation program
if "%1"=="" (cls&echo/&echo=&set /p nn=Please enter the number of menu items to create :&goto pp) else goto cc

:pp
%~n0 %nn%

:cc
cls&echo/&echo\&echo
echo ------------------------------------------------------------------------------
echo **************************** Code By:XXXXX **********************************
echo ------------------------------------------------------------------------------
for /l %%a in (1=1=%1) do (
set/p= <nul&set/p a%%a=Menu item %%a content:
set "b=!b! "!a%%a!""
)
cls
set "space= "
set "vol= │ "
:kk
%ww% echo ╭────────╮ %qq%
%ww% echo ╭───────┤ Option ├─────────╮ %qq%
%ww% echo │ ╰────────╯ │ %qq%

for %%i in (%b%) do (
set a=%vol%%%~i%space%
%ww% echo !a:~0,63!│%qq%
%ww% echo │ │%qq%
)
%ww% echo │ │%qq%
%ww% echo │ │%qq%
%ww% echo │ │%qq%
%ww% echo ╰──────────────────────────╯%qq%
if defined qq (echo Your menu has already been generated as file project.cmd&goto :eof)
echo So, are you satisfied with this menu?
set/p mm=(1: satisfied 2: redesign 3: exit) :
if "%mm%"=="1" goto jj
if "%mm%"=="2" %~n0
if "%mm%"=="3" cls&echo/&echo]&echo Program exited!!!&goto :eof

:jj
set qq=^>^>project.cmd
set ww=echo
echo @echo off>>project.cmd
goto kk


=========================
bjsh: For some reason, the OP edited the post back then. The above quote is from ccwan's later post.

[ Last edited by bjsh on 2008-4-28 at 04:16 PM
Recent Ratings for This Post ( 11 in total) Click for details
RaterScoreTime
ccwan +5 2006-12-24 05:34
redtek +9 2006-12-24 05:38
lxmxn +4 2006-12-24 07:55
HUNRYBECKY +2 2006-12-26 22:17
jmz573515 +4 2006-12-26 22:37
axi +2 2007-03-15 08:23
neolxx +1 2007-10-23 16:11
a123456 -1 2007-10-26 23:26
chainliq -5 2007-12-15 02:27
-1 2007-12-15 02:31
PPdos -4 2008-04-28 05:11
我今后在论坛的目标就是做个超级坏人!!!
Floor 2 Posted 2006-12-24 05:32 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Downloaded it.
Thanks.
Floor 3 Posted 2006-12-24 05:34 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Someone already grabbed the first reply, so I'll take the second reply.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 4 Posted 2006-12-24 05:37 ·  中国 北京 朝阳区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Bump~~! Downloaded and collected~~
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 5 Posted 2006-12-24 05:41 ·  中国 北京 联通
银牌会员
★★★
努力做坏人
Credits 1,185
Posts 438
Joined 2006-08-28 12:00
19-year member
UID 61449
From 北京
Status Offline
Everyone, there's one mistake, hehe.
Change the line if "%mm%"=="2" %~n0 to if "%mm%"=="2" (set b=&%~n0)
I wasn't careful enough when testing it.
我今后在论坛的目标就是做个超级坏人!!!
Floor 6 Posted 2006-12-24 05:48 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
After testing twice, there doesn't seem to be any difference?
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 7 Posted 2006-12-24 05:49 ·  中国 北京 联通
银牌会员
★★★
努力做坏人
Credits 1,185
Posts 438
Joined 2006-08-28 12:00
19-year member
UID 61449
From 北京
Status Offline
No, the error appears in the redesign part.
我今后在论坛的目标就是做个超级坏人!!!
Floor 8 Posted 2006-12-24 05:52 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
=_=|||
I was careless.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 9 Posted 2006-12-24 05:56 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
  It would be nice if the menu options could be centered.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 10 Posted 2006-12-24 06:46 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Bump
Floor 11 Posted 2006-12-24 07:56 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  Batch files can now rival some software. And they're more eco-friendly too~~ ^_^
Floor 12 Posted 2006-12-24 08:47 ·  中国 江西 九江 电信
初级用户
Credits 103
Posts 43
Joined 2006-12-22 23:30
19-year member
UID 74302
Gender Male
Status Offline
There's a loop statement in here, right? Then where is the system return value stored?
Floor 13 Posted 2006-12-24 11:07 ·  中国 甘肃 兰州 城关区 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Yeah, ~all right now, no need to keep hammering the spacebar anymore.
Floor 14 Posted 2006-12-26 22:17 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Haven't been here in a long time, and there are already so many good things again.
Floor 15 Posted 2006-12-26 22:29 ·  中国 辽宁 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
Not bad, good stuff!
1 2 3 6 Next ›
Forum Jump: