Menu for Windows Command Prompt Via Batch File Tutorial

Menu for Windows Command Prompt Via Batch File Tutorial

Menu for Windows Command Prompt Via Batch File Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')

For today’s tutorial we build a menu-driven Windows Batch (at Command Prompt window) , building on previous More Windows Command Prompt Via Batch File Tutorial presented below. Windows Batch procedures can incorporate some of the features that we like from the web such as menus (but without the buttons and pictures). Of course none of this is new and Windows Batch was doing this long before Websites existed, but think both disciplines have more in common than you think (as far as what works for people navigation-wise), and with today’s huge visual distractions on websites it can be good (and anal) to do your Windows desktop work with fewer distractions using Windows Batch procedures (writable (and tailorable (is that a word?)) by all of us, if the company security policy allows?!). Besides that the tutorial will show you “ducking off” to the Internet to get some information, something that is fairly easy to do with Windows Batch programming.

Would like to point out a few ideas:

  • CHOICE command
  • CALL command
  • START and EXIT commands
  • DATE /T and TIME /T commands
  • Tamagotchi (beep) style of rudimentary Fish Feeding game is arranged so its supervisory parts stay in the main menu batch file (called index.bat (wonder why?!)) and its client parts are in a separate batch file accessed by CALL and returning information via arguments back to the main menu batch file
  • Use of CHOICE with a timeout could make this procedure one that keeps the computer awake (another method to do this can be an AutoHotKey stay-resident procedure)
  • The beep functionality (which is optional … see the IF NOT EXIST syntax) is achieved via echo @echo (Alt-7) >beep.bat (ie. hold Alt and 7 (of the numeric keypad) together, as per advice within this webpage … thanks)
  • Use of Environment variables where, at all, possible eg. %ProgramFiles%
  • For menu-driven programs it can be good (but is optional) to be anal, and use trivial called Windows Batch files (with even as little as one line of code) rather than crowding (or making it unnecessarily inconsistent) the main Windows Batch file eg. Show_Task_List.bat

Here is some downloadable Windows Command Prompt Batch File programming source code for the main (or parent, or supervisory) Windows Batch file which you could rename to index.bat.

Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to More_Options.bat.

Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to Show_Company_Report.bat.

Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to Feed_the_Fish.bat.

Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to Show_Task_List.bat.

Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to beep.bat which may not work as a download, in which case the instructions to create it are … echo @echo (Alt-7)>beep.bat … Alt key and 7 from numeric keypad at the same time at a Windows Command Prompt in the correct directory … this file is optional.

Enjoy this tutorial.


Previous More Windows Command Prompt Via Batch File Tutorial shown below.

More Windows Command Prompt Via Batch File Tutorial

More Windows Command Prompt Via Batch File Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')

This tutorial builds on the previous Windows Command Prompt Via Batch File tutorial, showing you the use of some Windows Command Prompt commands such as set /a, set /p, date, time, echo, pause, call, if, goto, for/f, systeminfo, ping, choice to help with your continued research. Windows Command Prompt Batch files can do amazing things and I’d like to link you to Strings for some brilliant thoughts regarding this. The date parsing ideas were from Windows Batch File (.bat): Get Current Date as MMDDYYYY (thanks a lot).

Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to ideas.bat as you see fit (and hopefully don’t have a fit?!).


Previous Windows Command Prompt Via Batch File tutorial below:

Windows Command Prompt Via Batch File

Windows Command Prompt Via Batch File

Tutorial

Transcript:

Do you own a Windows computer?

Have you heard of Command Prompt, or MS-DOS, or the DOS prompt?

It is like Bash Scripting on Linux or Korn Shell scripting on Unix
and could open a whole new world of possibilities for your work
in Windows.

If you are a beginner you need to start slowly, and in this
tutorial we will only do benign commands that, for the most part,
read rather than write anything.

We’ll do a bit of:

cd
echo
cd [place]
dir
type
more
tasklist
vol

In your search engine look for “MS-DOS commands” for further
information. Once you see a command of interest, at
Command Prompt you can type:

help [command]

… to find further information.

So here goes … we will open the Command Prompt application … then run a preprepared
Batch script … but just concentrate on its commands, rather than doing scripting
… that is for later … at the end of the presentation the Batch script is typed
out for you.

Let’s explore some more command prompt commands below on 20/3/2013 …

Windows Command Prompt ... more

Windows Command Prompt ... more

Great Command Prompt Information Link

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>