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-22 11:47
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 请问这个带有选择项的批处理是怎么样实现的 请问这个带有选择项的批处理是怎么样实现的 请问这个带有选择项的批处理是怎么样实现的 What is the way to implement this batch processing with options? What is the way to implement this batch processing with options? What is the way to implement this batch processing with options? View 3,621 Replies 35
Floor 16 Posted 2006-11-02 22:24 ·  中国 福建 泉州 晋江市 电信
初级用户
Credits 97
Posts 40
Joined 2006-11-01 13:59
19-year member
UID 69168
Gender Male
Status Offline
I use a 98 boot disk, so I use the CHOICE.COM downloaded from this forum.

VM is the abbreviation of vmware, and its Chinese name is virtual machine.
Floor 17 Posted 2006-11-02 22:42 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Sweat~ What operating system is in the VM (virtual machine)? (A virtual machine can install any system, so why do I ask what operating system?)

If it's a 98 boot disk, you can't run this batch file. The first command
CLS
COLOR 0A
Pure DOS doesn't have the COLOR 0A command, let alone the NET START command

The reason you mentioned that the batch file jumps out after executing the first command is that you may have used the COMMAND.COM /F parameter in CONFIG.SYS

All answers are just guesses~
第一高手 第二高手

Floor 18 Posted 2006-11-02 22:51 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 19 Posted 2006-11-02 22:55 ·  中国 福建 泉州 晋江市 电信
初级用户
Credits 97
Posts 40
Joined 2006-11-01 13:59
19-year member
UID 69168
Gender Male
Status Offline
In the VM, it's an empty system because the old system was just deleted by me the other day and a new system hasn't been installed yet. The post on the first floor was what I found from the VM green version, and I want to modify it according to this batch file to meet my needs. So there is no COLOR OA command. What I mean is not that after executing the first command, the batch file pops up, but directly running the first command. Simply put, it just doesn't let me choose at all. Also, if it were the AUTOEXEC.BAT self-running batch file, it would be easy. Just cooperate with CONFIG.SYS to have options, but the problem is that this is just an ordinary batch file, which is manually input and started when needed after booting into DOS
Floor 20 Posted 2006-11-02 22:59 ·  中国 福建 泉州 晋江市 电信
初级用户
Credits 97
Posts 40
Joined 2006-11-01 13:59
19-year member
UID 69168
Gender Male
Status Offline
This is the batch processing I want to use

@ECHO OFF
CLS
GOTO MENU

:MENU
ECHO.
ECHO. =-=-=-=-=-=-=-=--=-=-=--=-=-=--=-=-=-=
ECHO.
ECHO.
ECHO.
ECHO. 1 Restore F11 message and function.
ECHO.
ECHO. 2 Suppress F11 message but retain the F11 function.
ECHO.
ECHO. 3 Disable F11 message and function.
ECHO.
ECHO.
ECHO. 4 E X I T
ECHO.
ECHO.
ECHO.
ECHO.
ECHO. =-=-=-=-=-=-=-=--=-=-=--=-=-=--=-=-=-=
ECHO.


w:\CHOICE.com /N /C:1234 please select 1/2/3/4....:
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO RESTORE
IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 GOTO SUPPRESS
IF ERRORLEVEL 3 IF NOT ERRORLEVEL 4 GOTO DISABLE
IF ERRORLEVEL 4 IF NOT ERRORLEVEL 5 GOTO restort
PAUSE


:RESTORE
echo.1
pause
copy BMGRUS.BA1 BMGRUS.SCR
W:\bmgr.exe /Fboot.bin /Mbmgr%CC%.scr /s
GOTO EXIT

:SUPPRESS
echo.2
pause
fdisk/mbr
copy BMGRUS.BA2 BMGRUS.SCR
W:\bmgr.exe /Fboot.bin /Mbmgr%CC%.scr /s
type bmgrus.scr
pause
GOTO EXIT

:DISABLE
echo.3
pause
fdisk/mbr
GOTO EXIT

:restort
restort.com

:EXIT
del BMGRUS.SCR
Echo Remove the diskette and press CTRL-ALT-DEL to restart the computer.
Floor 21 Posted 2006-11-02 23:08 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
The CHOICE used in the 98 startup disk
Attachments
choice.rar (2.83 KiB, Credits to download 1 pts, Downloads: 11)
第一高手 第二高手

Floor 22 Posted 2006-11-02 23:17 ·  中国 福建 泉州 晋江市 电信
初级用户
Credits 97
Posts 40
Joined 2006-11-01 13:59
19-year member
UID 69168
Gender Male
Status Offline
Downloaded this one to compare, and both the CRC32 and modification time are the same as the version I downloaded earlier.
Floor 23 Posted 2006-11-02 23:33 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
CHOICE /N /C:12345678 /T:1,60 Choose the boot item by pressing the number keys (1-8)
rem (Stay for 60 seconds and default to start 1)
第一高手 第二高手

Floor 24 Posted 2006-11-03 00:02 ·  中国 福建 泉州 晋江市 电信
初级用户
Credits 97
Posts 40
Joined 2006-11-01 13:59
19-year member
UID 69168
Gender Male
Status Offline
Originally posted by fastslz at 2006-11-2 11:33 PM:
CHOICE /N /C:12345678 /T:1,60 Press the number keys (1 to 8) to select the boot item
rem (Stay for 60 seconds, default boot is 1)




In the VM, this prompt still appears, and no matter which item is selected, the first one is still executed
Floor 25 Posted 2006-11-03 02:30 ·  中国 北京 中移铁通
初级用户
Credits 28
Posts 14
Joined 2006-08-16 14:31
19-year member
UID 60645
Status Offline
It should be calling system variables.

See if this helps

The following table lists the system and local environment variables of Windows XP.

Variable Type Description
%ALLUSERSPROFILE% Local Returns the location of all "user profiles".
%APPDATA% Local Returns the location where applications store data by default.
%CD% Local Returns the current directory string.
%CMDCMDLINE% Local Returns the exact command line used to start the current Cmd.exe.
%CMDEXTVERSION% System Returns the version number of the current "command processor extension".
%COMPUTERNAME% System Returns the name of the computer.
%COMSPEC% System Returns the exact path of the command-line interpreter executable.
%DATE% System Returns the current date. Uses the same format as the date /t command. Generated by Cmd.exe. For more information about the date command, see Date.
%ERRORLEVEL% System Returns the error code of the most recently used command. Usually indicated by a non-zero value for an error.
%HOMEDRIVE% System Returns the local workstation drive letter connected to the user's home directory. Based on the setting of the home directory value. The user's home directory is specified in "Local Users and Groups".
%HOMEPATH% System Returns the full path of the user's home directory. Based on the setting of the home directory value. The user's home directory is specified in "Local Users and Groups".
%HOMESHARE% System Returns the network path of the user's shared home directory. Based on the setting of the home directory value. The user's home directory is specified in "Local Users and Groups".
%LOGONSEVER% Local Returns the name of the domain controller that authenticates the current login session.
%NUMBER_OF_PROCESSORS% System Specifies the number of processors installed on the computer.
%OS% System Returns the name of the operating system. Windows 2000 displays the operating system as Windows_NT.
%PATH% System Specifies the search path for executable files.
%PATHEXT% System Returns the list of file extensions that the operating system considers executable.
%PROCESSOR_ARCHITECTURE% System Returns the chip architecture of the processor. Values: x86, IA64.
%PROCESSOR_IDENTFIER% System Returns the processor description.
%PROCESSOR_LEVEL% System Returns the model of the processor installed on the computer.
%PROCESSOR_LEVEL% System Returns the version number of the processor.
%PROMPT% Local Returns the command prompt setting of the current interpreter. Generated by Cmd.exe.
%RANDOM% System Returns any decimal number between 0 and 32767. Generated by Cmd.exe.
%SYSTEMDRIVE% System Returns the drive that contains the Windows XP root directory (that is, the system root directory).
%SYSTEMROOT% System Returns the location of the Windows XP root directory.
%TEMP% and %TMP% System and User Returns the default temporary directory used by applications available to the current logged-in user. Some applications need TEMP, while others need TMP.
%TIME% System Returns the current time. Uses the same format as the time /t command. Generated by Cmd.exe. For more information about the time command, see Time.
%USERDOMAIN% Local Returns the name of the domain that contains the user account.
%USERNAME% Local Returns the name of the currently logged-in user.
%UserPrefix% Local Returns the location of the current user's profile.
%WINDIR% System Returns the location of the operating system directory.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
redtek +2 2006-11-03 06:34
Floor 26 Posted 2006-11-03 06:23 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  The above regarding environment variables, there are two places that need to be corrected:

%PROCESSOR_LEVEL% System Returns the model of the processor installed on the computer.
%PROCESSOR_LEVEL% System Returns the version number of the processor.

  These two are repeated. One of them is "%PROCESSOR_REVISION%"----System-----System variable that returns the revision number of the processor.


%TIME% System Returns the current time. Uses the same format as the time /t command. Generated by Cmd.exe. For more information about the time command, see Time.

  The information returned by %TIME% is not in the same format as the "time /t" command. "time /t" only displays the hour and minute, and is not as precise as the value returned by %TIME%.

Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
redtek +2 2006-11-03 06:34
Floor 27 Posted 2006-11-03 06:34 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
The meticulous earnest help of lxmxn and the enthusiasm of ljs3509 are worthy of learning ~ :)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 28 Posted 2006-11-03 06:40 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Originally posted by redtek at 2006-11-3 06:34:
The meticulous seriousness and helpfulness of lxmxn and the enthusiasm of ljs3509 are worth learning~:)

  Redtek should publicize the fact that he gave good comrades points to play an inspiring role. Otherwise, others who are given points may not even be aware of it. ——I was also given points, and I got excited and came to support Redtek——Look, this is the effect of being given points啊
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 29 Posted 2006-11-03 06:48 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Haha... Thanks the moderator for the praise~ : )
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 30 Posted 2006-11-03 07:14 ·  中国 甘肃 甘南藏族自治州 合作市 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Forum Jump: