如何在 MSDOS 7.1 中设置变量(通过提示)

如何在 MSDOS 7.1 中设置变量(通过提示)

在 CMD 中,我可以执行Set /P ASK=REPEAT,它会提示用户ASK。如何在 MSDOS 批处理文件中执行此操作?(不,不是在 NT 上运行的批处理文件,而是在 MSDOS 上运行的批处理文件。)

顺便说一句:“Set /P”是一个 NT 答案,所以它不起作用。

:(

答案1

这些中的一个怎么样……

资源: http://www.msfn.org/board/topic/174005-prompt-for-variable-in-dos-71/

示例 test.bas 可以使用:C:\DOS71\QBASIC /run test.bas

REM Get the users input.
INPUT "Enter the system Serial Number"; reply$

REM Show the value of the reply.
PRINT reply$

REM Return to the system.
SYSTEM

或者

editvar -p "Enter the system Serial Number." INPUT
rem temp.exe /ss %INPUT%
md %INPUT%

更新

在线模拟器: https://archive.org/details/msdos_qbasic_megapack

资源: https://support.microsoft.com/en-us/kb/81360

Editor is a full screen text editor. QBasic is a program that reads instructions written in Basic and interprets them into executable computer code. 

The EDIT command starts Editor from the command prompt. QBASIC starts the QBasic Interpreter from the command prompt. Both Editor and QBasic may be executed with a switch or combination of switches to enhance or modify their performance. The following is a description of the switches available and how they affect Editor and QBasic:
    Switch   Description
   ------   -----------

   /B       Displays Editor or QBasic in black and white. This switch
            should be used to run Editor or QBasic on a monochrome
            monitor with a color graphics card. If the Editor or
            QBasic pull-down menus do not show the short cut keys on a
            CGA monitor, then use the /B switch when starting Editor
            or QBasic.

   /G       Use this switch with a CGA monitor to provide the fastest
            screen updating.

   /H       Use this switch to display the maximum number of lines on
            the screen that the monitor supports.

   /NOHI    Editor and QBasic are designed for 16 color monitors, but
            this switch allows Editor or QBasic to function on an
            eight color monitor. If Editor or QBasic pull-down menus
            do not show the short cut keys on a system that does not
            support bold characters, use the /NOHI switch when
            starting Editor or QBasic.

The following switches may be used only with QBasic:
   Switch     Description
   ------     -----------

   /EDITOR    Invokes Editor.

   /MBF       Converts the built-in functions MKS$,MKD$,CVS$, and CVD
              to MKSMBF$, MKDMBF$, CVSMBF, and CVDMBF, respectively.

   /RUN       Runs a specified Basic program before displaying it.

To start Editor with the /NOHI switch, type the following command at the command prompt:
edit /nohi
To start QBasic and run the program MYPROG.BAS, type the following at the command prompt:
qbasic /run myprog.bas
Reference(s): 

"MS-DOS User's Guide and Reference," versions 5.0 and 5.0a, pages 459, 547

答案2

这是使用旧版 DOS 进行输入的旧方法。我没有旧版 DOS,因此很难进行测试,不过我会为您提供代码和页面,其中显示了使用旧版 DOS 进行输入的各种方法。这是代码。

ECHO Enter some input, and press Enter when ready . . .
ECHO ?[13;0;64;13p
COPY CON USRINPUT.TMP
ECHO ?[13;13p
CLS
ECHO You typed:
TYPE USRINPUT.TMP

请访问此站点以获取更多示例。

批处理文件 - 询问用户输入

答案3

CHOICE 是 MSDOS 6.22 中存在的命令,我推测 7.1 中也存在该命令,尽管确切的语法可能有所不同。例如:

CHOICE /C:YN /T:N,10 Do you want to continue
IF ERRORLEVEL 2 GOTO :eof
ECHO You chose Y, continuing
:eof

/C 选项允许您指定允许的选项 /T 选项允许您指定默认选项和超时

尝试CHOICE /?获取有关您的 DOS 版本的详细信息。

相关内容