中国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-25 04:54
47,813 topics / 349,918 posts / today 1 new / 48,274 members
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?
Printable Version  4,189 / 35
Floor16 qingyangecho Posted 2006-11-02 22:24
初级用户 Posts 40 Credits 97
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.
Floor17 fastslz Posted 2006-11-02 22:42
铂金会员 Posts 2,315 Credits 5,493 From 上海
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~
Floor18 不得不爱 Posted 2006-11-02 22:51
超级版主 Posts 2,044 Credits 5,310 From 四川南充
Your batch script cannot run under pure DOS in C.
Floor19 qingyangecho Posted 2006-11-02 22:55
初级用户 Posts 40 Credits 97
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
Floor20 qingyangecho Posted 2006-11-02 22:59
初级用户 Posts 40 Credits 97
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.
Floor21 fastslz Posted 2006-11-02 23:08
铂金会员 Posts 2,315 Credits 5,493 From 上海
The CHOICE used in the 98 startup disk

Attachments
choice.rar (2.83 KiB)
Floor22 qingyangecho Posted 2006-11-02 23:17
初级用户 Posts 40 Credits 97
Downloaded this one to compare, and both the CRC32 and modification time are the same as the version I downloaded earlier.
Floor23 fastslz Posted 2006-11-02 23:33
铂金会员 Posts 2,315 Credits 5,493 From 上海
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)
Floor24 qingyangecho Posted 2006-11-03 00:02
初级用户 Posts 40 Credits 97
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
Floor25 ljs3509 Posted 2006-11-03 02:30
初级用户 Posts 14 Credits 28
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.
Floor26 lxmxn Posted 2006-11-03 06:23
版主 Posts 4,938 Credits 11,386

  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%.

Floor27 redtek Posted 2006-11-03 06:34
金牌会员 Posts 1,147 Credits 2,902
The meticulous earnest help of lxmxn and the enthusiasm of ljs3509 are worthy of learning ~ :)
Floor28 namejm Posted 2006-11-03 06:40
荣誉版主 Posts 1,737 Credits 5,226 From 成都
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啊
Floor29 redtek Posted 2006-11-03 06:48
金牌会员 Posts 1,147 Credits 2,902
Haha... Thanks the moderator for the praise~ : )
Floor30 vkill Posted 2006-11-03 07:14
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Prev  1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023