Multi-level menu system (better help on DOS commands)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Aacini
Expert
Posts: 1670
Joined: 06 Dec 2011 22:15
Location: México City, México

Multi-level menu system (better help on DOS commands)

#1 Post by Aacini » 05 Nov 2012 21:30

I developed a multi-level menu-driven system written in Batch that can be used to display information and/or execute programs. It use a text file to define the menu options, so it is easily configurable for any user needs.

MENUSYS.BAT:

Code: Select all

@echo off

rem Configurable multi-level menu-driven system
rem Antonio Perez Ayala, Nov/5/2012

if "%~1" neq "/?" goto start

echo Activate a menu-driven system.
echo/
echo MENUSYS [menudef]
echo/
echo Menudef is the name of a menu definition file with no extension; the default
echo file name DOSHELP.MNU is used if not given. The first two lines of this file
echo define menu Title and Header, followed by the options of each sub-menu that
echo ends in :END line. Each menu option is defined with a line that start with a
echo word in upper case letters followed by a description. For example:
echo/
echo     Menu Title
echo     Menu Header
echo     OPTION1  Description of first option
echo     OPTION2  Description of second option
echo     :END
echo/
echo If the line next to an option start with :FINAL indicate a final-level option
echo comprised of the following lines until next :END line. :FINAL line indicate
echo the way to process the option via two comma-separated parameters; the first to
echo display the option description, and second to display or execute option lines:
echo/
echo     Menu Title
echo     Menu Header
echo     OPTION1  Option with description that show two lines
echo     :FINAL HEAD,SHOW
echo     These lines will be displayed
echo     when OPTION1 be selected
echo     :END
echo     OPTION2  Option with no description that execute a command
echo     :FINAL NOHEAD,EXEC
echo     ANYCOMMAND PARAM /SWITCH ETC
echo     :END
echo     :END
echo/
echo If an option is not final, then it will open a sub-menu that must be defined
echo later. All first-level options must be defined first, followed by all second-
echo level options and so on, in ascending order into each level.
echo/
echo You may insert :REM lines with comments before the first option of each
echo sub-menu (after :END line of previous sub-menu).
echo/
echo You may review a large example of menu definition in DOSHELP.MNU file.
goto :EOF


:start
setlocal EnableDelayedExpansion
set "menuPath=%~DP0"
set menuName=DOSHELP
if "%~1" neq "" set "menuPath=%~DP1" & set "menuName=%~N1"
if not exist "%menuPath%%menuName%.mnu" echo File not found: %menuPath%%menuName%.mnu & goto :EOF


:main
set while=if not
set do=goto endwhile
set endwhile=goto while
set repeat=goto repeat
set until=if not
call :LoadMenu < "%menuPath%%menuName%.mnu"
color 1F
set final=
set level=0
:while
%while% %level% geq 0 %do%
   set title=!title[%level%]!
   call :ShowMenuAndGetOption
   if %option% gtr 0 (
      rem Activate a sub-menu or final option
      set final=!final[%previous%.%option%]!
      set /A level+=1
      set prev[!level!]=%option%
      set title[!level!]=!title! - !menu[%previous%.%option%]!
   ) else (
      rem Exit from a sub-menu
      set final=
      set /A level-=1
   )
%endwhile%
:endwhile
title MS-DOS
color
cls
goto :EOF


:LoadMenu
echo Loading menu...
set /P title[0]=
set /P menu[0]=
rem Load all sub-menus
set /A missing=0, defined=0, previous=0
:while1
%while% defined previous %do%1
   set /P line=
   :while2
   %while% "%line:~0,4%" equ ":REM" %do%2
      set /P line=
   %endwhile%2
   :endwhile2
   rem Load all options of a sub-menu
   set option=0
   :while3
   %while% "%line:~0,4%" neq ":END" %do%3
      set /A option+=1
      for /F %%a in ("%line%") do set word=%%a
      set menu[%previous%.%option%]=%word%
      set mssg[%previous%.%option%]=!line:*%word%=!
      set /P line=
      if "%line:~0,6%" neq ":FINAL" goto else
         rem This option is a final-level one: load all its lines
         set final[%previous%.%option%]=%line:~7%
         set i=0
         set /P line=
         :while4
         %while% "!line:~0,4!" neq ":END" %do%4
            set /A i+=1
            set menu[%previous%.%option%.%i%]=!line!
            set line=
            set /P line=
         %endwhile%4
         :endwhile4
         set last[%previous%.%option%]=%i%
         set /P line=
         goto endif
      :else
         rem Sub-menu of this option must be defined later
         set /A missing+=1
         set submenu[%missing%]=%previous%.%option%
      :endif
   %endwhile%3
   :endwhile3
   set last[%previous%]=%option%
   rem Pass to define next missing sub-menu
   set submenu[%defined%]=
   set /A defined+=1
   set previous=!submenu[%defined%]!
%endwhile%1
:endwhile1
exit /B


:ShowMenuAndGetOption
title !title!
rem Show previous menus headers
cls
echo/
echo         %menu[0]%
set previous=0
for /L %%i in (1,1,%level%) do (
   set previous=!previous!.!prev[%%i]!
   for %%m in (mssg[!previous!]) do set header=!%%m!
   if %%i lss %level% (
      call :showHeader !header!
   ) else (
      if not defined final (
         call :showHeader !header!
      ) else (
         if /I "!final:~0,4!" equ "HEAD" call :showAtLeft !header!
      )
   )
)
rem Show this menu options or description
echo/
echo/
set last=!last[%previous%]!
if defined final goto else2
   rem Show menu and get option
   set space=
   if %last% gtr 9 set "space= "
   for /L %%i in (1,1,%last%) do (
      if %%i equ 10 set space=
      echo     %%i-!space! !menu[%previous%.%%i]!!mssg[%previous%.%%i]!
   )
   echo/
   echo/
   :repeat
      set option=0
      set /P option=    Type the desired option (Enter to exit):
      set /A option=option
   %until% %option% leq %last% %repeat%
   goto endif2
:else2
   if /I !final:~-4! equ EXEC goto else3
      rem Show final-level lines
      for /L %%i in (1,1,%last%) do echo/!menu[%previous%.%%i]!
      goto endif3
   :else3
      rem Execute final-level lines
      set i=1
      :while5
      %while% %i% leq %last% %do%5
         set option=!menu[%previous%.%i%]!
         %option%
         set /A i+=1
      %endwhile%5
      :endwhile5
   :endif3
   echo/
   echo/
   set /P option=Press Enter to continue
   set option=0
:endif2
exit /B


:showHeader header
echo/
echo/
echo     %previous:~2%- %*
exit /B


:showAtLeft header
echo/
echo/
echo %*
exit /B
Previous program use a text file with .MNU extension to define the menu, as described if /? parameter is used. The default menu file is DOSHELP.MNU that show help on DOS commands in a similiar way of HELP command, but in a much more organized scheme that also include help on some additional DOS topics.

DOSHELP.MNU:

Code: Select all

Windows-DOS Commands Help
       W I N D O W S - D O S   C O M M A N D S   H E L P
:REM
:REM DOSHELP.MNU: MENU DEFINITION FILE FOR HELP ON DOS COMMANDS AND FEATURES
:REM ANTONIO PEREZ AYALA, NOV/5/2012
:REM
:REM FIRST-LEVEL MENU OPTIONS 1 TO 10
:REM
CHARACTERS     Special Characters used in DOS commands and Batch files
:FINAL HEAD,SHOW
 ,;=  Separators for command parameters and FOR sets, besides spaces.
  *?  Wild-card characters that matches several file and directory names.
   @  Placed before a command does not echo it even if ECHO is ON: @ECHO OFF

   >  Send command output to a new disk file: COMMAND > OUTPUT.TXT
      The DOS waste bin is called NUL: COPY *.* DEST > NUL
  >>  Append command output if the file exists: COMMAND >> APPEND.TXT
  2>  Send error messages to a disk file: COMMAND 2> ERRORS.TXT
2>&1  Send error messages to the same file of >: COMMAND > ALL.TXT 2>&1
   <  Get command input from a disk file: COMMAND < INPUT.TXT

   &  COM1 & COM2 is the same as execute COM1 and then execute COM2
   |  COM1 | COM2 is the same as: COM1 > F.TMP & COM2 < F.TMP & DEL F.TMP
  &&  COM1 && COM2 is the same as: COM1 & IF NOT ERRORLEVEL 1 COM2
  ||  COM1 || COM2 is the same as: COM1 & IF ERRORLEVEL 1 COM2
  ()  Group together several commands: ( COM1 & COM2 & COM3 ) > THREE.TXT

   %  Take the value of Batch parameters (%1 ...), FOR parameters (%%A ...)
      and Batch variables (%VAR%); %* always take all of the Batch parameters.
      A FOR command typed in the command-line must use a single percent char.
   !  Additional way (Delayed Expansion) to take the value of a variable: !VAR!
   ^  Insert, not process, the next special character: ECHO ^<ABC^> show <ABC>
      An exclamation mark can not be inserted in a Batch file this way: ^! if
      Delayed !VARIABLE! Expansion is Enabled.
:END
SCREEN         Commands for Screen control
FILE           Commands for File management
DIRECTORY      Commands to create, change and remove Directories
DISK           Commands for Disk maintenance
PROCESS        Commands to execute, view or cancel Programs
COMMUNICATIONS Commands to manage inter-computer Communications
ACCESSORIES    Commands to start standard Windows Accessories
BATCH          Commands, Values and Modifiers used in Batch files
VARIOUS        Commands that do not fit in any previous subdivision
:END
:REM SECOND-LEVEL MENU OPTIONS
:REM
:REM OPTIONS 2.1 TO 2.5
TITLE    Sets the window title for a CMD.EXE session.
:FINAL NOHEAD,EXEC
TITLE /?
:END
COLOR    Sets the default console foreground and background colors.
:FINAL NOHEAD,EXEC
COLOR /?
:END
CLS      Clears the screen.
:FINAL NOHEAD,EXEC
CLS /?
:END
CHCP     Displays or sets the active code page number.
:FINAL NOHEAD,EXEC
CHCP /?
:END
GRAFTABL Enables Windows to display an extended character set.
:FINAL NOHEAD,EXEC
GRAFTABL /?
:END
:END
:REM OPTIONS 3.1 TO 3.2
WHOLE     Commands to manage files as a Whole
CONTENTS  Commands to process text file Contents
:END
:REM OPTIONS 4.1 TO 4.11
MD       Creates a directory.
:FINAL NOHEAD,EXEC
MD /?
:END
MKDIR    Creates a directory.
:FINAL NOHEAD,EXEC
MKDIR /?
:END
CD       Displays the name of or changes the current directory.
:FINAL NOHEAD,EXEC
CD /?
:END
CHDIR    Displays the name of or changes the current directory.
:FINAL NOHEAD,EXEC
CHDIR /?
:END
PUSHD    Saves the current directory then changes it.
:FINAL NOHEAD,EXEC
PUSHD /?
:END
POPD     Restores the previous value of the directory saved by PUSHD.
:FINAL NOHEAD,EXEC
POPD /?
:END
RD       Removes a directory.
:FINAL NOHEAD,EXEC
RD /?
:END
RMDIR    Removes a directory.
:FINAL NOHEAD,EXEC
RMDIR /?
:END
SUBST    Associates a directory with a drive letter.
:FINAL NOHEAD,EXEC
SUBST /?
:END
APPEND   Associates specified directories with the current directory.
:FINAL NOHEAD,EXEC
APPEND /?
:END
MOUNTVOL Creates, deletes, or lists a volume mount point.
:FINAL NOHEAD,EXEC
MOUNTVOL /?
:END
:END
:REM OPTIONS 5.1 TO 5.11
FORMAT   Formats a disk for use with Windows.
:FINAL NOHEAD,EXEC
FORMAT /? | MORE
:END
LABEL    Creates, changes, or deletes the volume label of a disk.
:FINAL NOHEAD,EXEC
LABEL /?
:END
VOL      Displays a disk volume label and serial number.
:FINAL NOHEAD,EXEC
VOL /?
:END
CHKDSK   Checks a disk and displays a status report.
:FINAL NOHEAD,EXEC
CHKDSK /?
:END
CHKNTFS  Displays or modifies the checking of disk at boot time.
:FINAL NOHEAD,EXEC
CHKNTFS /?
:END
CONVERT  Converts FAT volumes to NTFS.
:FINAL NOHEAD,EXEC
CONVERT /?
:END
COMPACT  Displays or alters the file compression on NTFS partitions.
:FINAL NOHEAD,EXEC
COMPACT /?
:END
CIPHER   Displays or alters the file encryption on NTFS partitions.
:FINAL NOHEAD,EXEC
CIPHER /? | MORE
:END
RECOVER  Recovers readable information from a bad or defective disk.
:FINAL NOHEAD,EXEC
RECOVER /?
:END
DISKCOPY Copies the contents of one floppy disk to another.
:FINAL NOHEAD,EXEC
DISKCOPY /?
:END
DISKCOMP Compares the contents of two floppy disks.
:FINAL NOHEAD,EXEC
DISKCOMP /?
:END
:END
:REM OPTIONS 6.1 TO 6.13
START    Starts a separate window to run a specified program.
:FINAL NOHEAD,EXEC
START /?
:END
RUNAS    Run a program with changed credentials.
:FINAL HEAD,EXEC
RUNAS /?
:END
AT       Schedules commands and programs to run on a computer.
:FINAL NOHEAD,EXEC
AT /?
:END
TASKLIST Displays a list of processes currently running.
:FINAL NOHEAD,EXEC
TASKLIST /? | MORE
:END
TASKKILL Ends one or more processes.
:FINAL NOHEAD,EXEC
TASKKILL /? | MORE
:END
TSKILL   Ends a process.
:FINAL NOHEAD,EXEC
TSKILL /?
:END
TSSHUTDN Shut down a server in a controlled manner.
:FINAL NOHEAD,EXEC
TSSHUTDN /?
:END
SHUTDOWN Shutdown/Restart the computer.
:FINAL HEAD,EXEC
SHUTDOWN /?
:END
SC       Communicate with the NT Service Controller and services.
:FINAL HEAD,EXEC
SC
:END
PATH     Displays or sets a search path for executable files.
:FINAL NOHEAD,EXEC
PATH /?
:END
ASSOC    Displays or modifies file extension associations.
:FINAL NOHEAD,EXEC
ASSOC /?
:END
FTYPE    Displays or modifies file types used in extension associations
:FINAL NOHEAD,EXEC
FTYPE /?
:END
SETVER   Sets the version number that MS-DOS reports to a program.
:FINAL NOHEAD,EXEC
SETVER /?
:END
:END
:REM OPTIONS 7.1 TO 7.6
MSG      Send a message to a user.
:FINAL NOHEAD,EXEC
MSG /?
:END
TELNET   Connects to a remote computer.
:FINAL HEAD,EXEC
TELNET /?
:END
TFTP     Transfers files to and from a remote computer.
:FINAL NOHEAD,EXEC
TFTP /?
:END
PING     Ping a remote computer.
:FINAL HEAD,EXEC
PING /?
:END
PATHPING Ping a remote computer via a route.
:FINAL HEAD,EXEC
PATHPING /?
:END
NET      Diverse commands to manage communications.
:FINAL HEAD,EXEC
NET
:END
:END
:REM OPTIONS 8.1 TO 8.7
CHARMAP  Start the Windows Character Map accessory.
:FINAL HEAD,SHOW
[START] CHARMAP
:END
CALC     Start the Windows Calculator accessory.
:FINAL HEAD,SHOW
[START] CALC
:END
CLIPBRD  Start the Windows ClipBoard viewer accessory.
:FINAL HEAD,SHOW
[START] CLIPBRD
:END
NOTEPAD  Start the Windows Notepad text editor.
:FINAL HEAD,SHOW
[START] NOTEPAD [drive:][path]textfile
:END
WRITE    Start the Windows WordPad text editor.
:FINAL HEAD,SHOW
[START] WRITE [drive:][path]textfile
:END
MSPAINT  Start the Windows Paint pictures editor.
:FINAL HEAD,SHOW
[START] MSPAINT [drive:][path][picturefile]
:END
TASKMGR  Start the Windows Task Manager accessory.
:FINAL HEAD,SHOW
[START] TASKMGR
:END
:END
:REM OPTIONS 9.1 TO 9.5
INTRODUCTION Introduction to Batch file programming
:FINAL HEAD,SHOW
A Batch file is a plain text file created with DOS EDIT or Windows Notepad
that have the .BAT extension; for example: EXAMPLE.BAT

Batch files contain the same DOS commands used in every day computer use,
like CD, COPY, etc. or the starting command for any additional application;
these commands are sequentially executed when the Batch file is executed.

Batch files may also contain specialized Batch commands, like IF, FOR, GOTO,
SET, etc. and may have access to parameters and variables that allows for a
more sophisticated processing similar in certain way to an old-fashioned
programming language, but with certain unique characteristics.

The power of Batch files may be increased to a certain level with the aid of
third party programs designed for that purpose; however, a Batch file can not
achieve any task that can not be achieved thru the execution of DOS commands.
In particular, a Batch file may not automatically control (execute) any
interactive and mouse-driven application, like most Windows programs.

On the other hand, Batch files are capable of achieve very sophisticated
processes that may include multi-dimensional arrays, advanced math, recursive
procedures and most capabilities of standard programming languages.
An example of such a program is this menu-driven system (MENUSYS.BAT).
:END
COMMANDS     Commands for Batch file programming
ERRORLEVEL   Description of the ERRORLEVEL value
:FINAL HEAD,SHOW
When most commands and programs ends they return an exit code, called
ERRORLEVEL, that is a signed integer 32-bits value. The MS-DOS standard
specify that a program return an ERRORLEVEL of zero if successfully ends,
but the value is greater than zero if the program ends because an error.

The following DOS commands, among others, return useful ERRORLEVEL values:
TYPE return 0 if the file was typed, return 1 if File not found.
COPY return 0 if file(s) was copied, return 1 if File not found.
FIND return 0 if the string was found, return 1 otherwise (also FINDSTR).
FC   return 0 if both files matched, return 1 otherwise.
CD   return 0 if directory was changed, return 1 if Dir not exists.
VOL  return 0 if volume was displayed, return 1 if invalid Drive.
TIME return 0 if given time is correct, return 1 if invalid Time (also DATE).
SET /P return 1 if line read is empty, otherwise NOT change ERRORLEVEL.
VERIFY return 1 if parameter is not ON or OFF, return 0 otherwise.
VER  always return 0.

The following internal DOS commands, among others, does not modify the
current ERRORLEVEL value: CLS, REM, ECHO, PAUSE, SHIFT, GOTO, SET var=value
All .COM and .EXE executable files modify the ERRORLEVEL when they ends.

To check the ERRORLEVEL use IF ERRORLEVEL Number Command that execute the
Command if the ERRORLEVEL value is greater than or equal to the given Number.

A Batch file may return any useful value via EXIT /B exitCode command.
For example, this is the one-line SETLEVEL.BAT file that allows to set the
ERRORLEVEL to any value given in its parameter: @EXIT /B %1

A Batch file may manage the ERRORLEVEL value in any way it wishes via the
%ERRORLEVEL% dynamic variable, for example: SET SAVELEVEL=%ERRORLEVEL%
:END
VARIABLES    Dynamic Batch Variables and enhanced expansions
:FINAL HEAD,SHOW
%CD%             Expands to the current directory string.
%DATE%           Expands to current date using same format as DATE command.
%TIME%           Expands to current time using same format as TIME command.
%RANDOM%         Expands to a random decimal number between 0 and 32767.
%ERRORLEVEL%     Expands to the current ERRORLEVEL value.

%var:old=new%    Substitute all occurrences of Old by New in Var expansion.
                 If Old start with asterisk, substitute from beginning of Var
                 value until first occurrence of Old.

%var:~pos,size%  Substring of Var from 0-based Position by Size characters; if
                 Pos or Size are negative, indicate a backwards position from
                 end. If Size is omitted, the substring ends at last character.

If Var is not defined two previous expansions are replaced by the text after
the colon, so this test must be made before the enhanced expansion.

If Delayed variable Expansion is enabled, a variable name may be enclosed in
exclamation marks instead percent signs to expand a new value modified inside a
FOR or IF. This may be combined with percents to achieve two expansions in the
same line, so certain advanced manipulations are possible. For example:

    SET /P OLD=Enter the old part:
    SET /P NEW=Enter the new part:
    SET CHANGED=!ORIGINAL:%OLD%=%NEW%!

    SET VECTOR[1]=Element One
    SET VECTOR[2]=Element Two, etc...
    SET I=set subscript value in some way
    ECHO The value of element %I% is: !VECTOR[%I%]!
:END
MODIFIERS    Enhanced expansions for replaceable parameters
:FINAL HEAD,SHOW
%~P      Expands %P removing any surrounding quotes.
%~fP     Expands %P to a Fully qualified path name.
%~dP     Expands %P to a Drive letter only (including the colon).
%~pP     Expands %P to a Path only (that start and end in backslash).
%~nP     Expands %P to a file Name only.
%~xP     Expands %P to a file eXtension only (including the dot).
%~sP     Expands %P to Short 8.3 names.
%~aP     Expands %P to file Attributes.
%~tP     Expands %P to date/Time of file.
%~zP     Expands %P to siZe of file.

%~$var:P Special case: Searches current %P file name in the directories listed
         in Var Batch variable and expands the parameter to the fully qualified
         path name of the first one found, or an empty string if not found.
         Do not use wild-cards with $ modifier.

Several modifiers may be combined in the same parameter: %~ntzP

The modifiers may not be used with %*

For example, the following command take the path of the running Batch file:
  SET MYPATH=%~p0
:END
:END
:REM OPTIONS 10.1 TO 10.10
HELP       Provides Help information for Windows commands.
:FINAL NOHEAD,EXEC
HELP /?
:END
DATE       Displays or sets the date.
:FINAL NOHEAD,EXEC
DATE /?
:END
TIME       Displays or sets the system time.
:FINAL NOHEAD,EXEC
TIME /?
:END
PROMPT     Changes the Windows command prompt.
:FINAL NOHEAD,EXEC
PROMPT /?
:END
DOSKEY     Edits command lines, recalls commands, and creates macros.
:FINAL NOHEAD,EXEC
DOSKEY /?
:END
MEM        Displays the amount of used and free memory in your system.
:FINAL NOHEAD,EXEC
MEM /?
:END
SYSTEMINFO Display basic system configuration information.
:FINAL NOHEAD,EXEC
SYSTEMINFO /?
:END
VER        Displays the Windows version.
:FINAL NOHEAD,EXEC
VER /?
:END
VERIFY     Tells Windows to verify that files are written correctly.
:FINAL NOHEAD,EXEC
VERIFY /?
:END
MODE       Configures a system device.
:FINAL NOHEAD,EXEC
MODE /?
:END
:END
:REM THIRD LEVEL OPTIONS
:REM
:REM OPTIONS 3.1.1 TO 3.1.16
DIR      Displays a list of files and subdirectories in a directory.
:FINAL NOHEAD,EXEC
DIR /?
:END
TREE     Graphically displays the directory structure of a drive/path.
:FINAL NOHEAD,EXEC
TREE /?
:END
REN      Renames a file or files.
:FINAL NOHEAD,EXEC
REN /?
:END
RENAME   Renames a file or files.
:FINAL NOHEAD,EXEC
RENAME /?
:END
COPY     Copies one or more files to another location.
:FINAL NOHEAD,EXEC
COPY /?
:END
XCOPY    Copies files and directory trees.
:FINAL NOHEAD,EXEC
XCOPY /? | MORE
:END
MOVE     Moves one or more files from one directory to another one.
:FINAL NOHEAD,EXEC
MOVE /?
:END
REPLACE  Replaces files.
:FINAL NOHEAD,EXEC
REPLACE /?
:END
DEL      Deletes one or more files.
:FINAL NOHEAD,EXEC
DEL /?
:END
ERASE    Deletes one or more files.
:FINAL NOHEAD,EXEC
ERASE /?
:END
ATTRIB   Displays or changes file attributes.
:FINAL NOHEAD,EXEC
ATTRIB /?
:END
CACLS    Displays or modifies access control lists (ACLs) of files.
:FINAL NOHEAD,EXEC
CACLS /?
:END
MAKECAB  Microsoft Windows Cabinet (compressed files) Maker.
:FINAL NOHEAD,EXEC
MAKECAB /?
:END
EXPAND   Expands one or more compressed (.CAB) files.
:FINAL NOHEAD,EXEC
EXPAND /?
:END
PACKAGER Microsoft Windows Object Package Maker.
:FINAL HEAD,SHOW
[START] PACKAGER

To make a package execute PACKAGER, then:

- Select File: Import... and Open the desired file (eg: ANYFILE.BAT).
- Select Edit: Copy Package.
- Open any folder and press Ctrl-V (or right click: Paste).
- A file named Scrap.shs is created; you may rename it as you wish preserving
  the .SHS extension, for example: REN SCRAP.SHS ANYFILE.SHS
- Close Object Packager.

To execute a package double-click on it or type its name with .SHS extension.

This method may be used to hide the source code of a Batch file.
:END
FSUTIL   Diverse commands for file and disk management.
:FINAL HEAD,EXEC
ECHO FSUTIL command
ECHO/
FSUTIL
:END
:END
:REM OPTIONS 3.2.1 TO 3.2.11
TYPE     Displays the contents of a text file.
:FINAL NOHEAD,EXEC
TYPE /?
:END
MORE     Displays output one screen at a time.
:FINAL NOHEAD,EXEC
MORE /?
:END
PRINT    Prints a text file.
:FINAL NOHEAD,EXEC
PRINT /?
:END
FIND     Searches for a text string in a file or files.
:FINAL NOHEAD,EXEC
FIND /?
:END
FINDSTR  Searches for strings in files.
:FINAL NOHEAD,EXEC
FINDSTR /? | MORE
:END
SORT     Sorts input.
:FINAL NOHEAD,EXEC
SORT /? | MORE
:END
FC       Compares two files or sets of files, and displays differences.
:FINAL NOHEAD,EXEC
FC /?
:END
COMP     Compares the contents of two files or sets of files.
:FINAL NOHEAD,EXEC
COMP /?
:END
EDIT     Start the MS-DOS text file editor.
:FINAL HEAD,EXEC
EDIT /?
:END
EDLIN    Starts Edlin, a line-oriented text editor.
:FINAL NOHEAD,EXEC
EDLIN /?
ECHO/
ECHO After Edlin starts, type ? to display a list of editing commands.
:END
DEBUG    Runs Debug, a program testing and editing tool.
:FINAL NOHEAD,EXEC
DEBUG /?
:END
:END
:REM OPTIONS 9.2.1 TO 9.2.13
REM      Records comments (remarks) in batch files or CONFIG.SYS.
:FINAL NOHEAD,EXEC
REM /?
:END
ECHO     Displays messages, or turns command echoing on or off.
:FINAL NOHEAD,EXEC
ECHO /?
:END
PAUSE    Suspends processing of a batch file and displays a message.
:FINAL NOHEAD,EXEC
PAUSE /?
:END
SHIFT    Shifts the position of replaceable parameters in batch files.
:FINAL NOHEAD,EXEC
SHIFT /?
:END
GOTO     Transfer batch file execution to another labeled line.
:FINAL NOHEAD,EXEC
GOTO /?
:END
IF       Performs conditional processing in batch programs.
:FINAL NOHEAD,EXEC
IF /?
:END
FOR      Runs a specified command for each file in a set of files.
:FINAL NOHEAD,EXEC
FOR /?
:END
SET      Displays, sets, or removes Windows environment variables.
:FINAL NOHEAD,EXEC
SET /?
:END
SETLOCAL Begins localization of environment changes in a batch file.
:FINAL NOHEAD,EXEC
SETLOCAL /?
:END
ENDLOCAL Ends localization of environment changes in a batch file.
:FINAL NOHEAD,EXEC
ENDLOCAL /?
:END
CALL     Calls one batch program from another.
:FINAL NOHEAD,EXEC
CALL /?
:END
CMD      Starts a new instance of the Windows command interpreter.
:FINAL NOHEAD,EXEC
CMD /?
:END
EXIT     Quits the CMD.EXE program (command interpreter).
:FINAL NOHEAD,EXEC
EXIT /?
:END
:END
:REM DOSHELP.MNU - END OF FILE
I wrote DOSHELP.MNU file based on commands in my Windows-XP computer. If you modify this file to add missing commands (like FORFILES, CHOICE, WMIC, etc.) please post your modifications.

Antonio
Last edited by Aacini on 22 Dec 2012 15:39, edited 6 times in total.

miskox
Posts: 359
Joined: 28 Jun 2010 03:46

Re: Multi-level menu system (better help on DOS commands)

#2 Post by miskox » 06 Nov 2012 01:19

Wow. Works great. Thank you! 10+

Saso

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Multi-level menu system (better help on DOS commands)

#3 Post by abc0502 » 06 Nov 2012 06:33

Really Nice Work, and the help docs too it is well organized.
Making menu to any program take long time that will help a lot thanks :D

Edit:
This trick you made to take only <Enter> is cool :)
BTW, how long did it take you to make this?

Post Reply