{"id":4196,"date":"2013-09-13T05:11:43","date_gmt":"2013-09-12T19:11:43","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4196"},"modified":"2020-04-17T17:40:48","modified_gmt":"2020-04-17T07:40:48","slug":"menu-for-windows-command-prompt-via-batch-file-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/menu-for-windows-command-prompt-via-batch-file-tutorial\/","title":{"rendered":"Menu for Windows Command Prompt Via Batch File Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/\"><img decoding=\"async\" style=\"float: left; border: 15px solid pink;\" id='imgatimeline' onmouseover=\"var xqw=this.src; if (xqw.indexOf('9') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-1of.jpg'; } else if (xqw.indexOf('8') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-9of.jpg'; } else if (xqw.indexOf('7') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-8of.jpg'; }  else if (xqw.indexOf('6') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-7of.jpg'; }  else if (xqw.indexOf('5') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-6of.jpg'; }  else if (xqw.indexOf('4') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_MenuBatch_Menu-5of.jpg'; }  else if (xqw.indexOf('3') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-4of.jpg'; }  else if (xqw.indexOf('2') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-3of.jpg'; }  else if (xqw.indexOf('1') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-2of.jpg'; } else { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu-1of.jpg'; } \" alt=\"Menu for Windows Command Prompt Via Batch File Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Windows_Batch_Menu.jpg\" title=\"Menu for Windows Command Prompt Via Batch File Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')\" \/><\/a><p class=\"wp-caption-text\">Menu for Windows Command Prompt Via Batch File Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')<\/p><\/div>\n<p>For today&#8217;s tutorial we build a menu-driven Windows Batch (at Command Prompt window) , building on previous <a href='#pmwcpt\" title='More Windows Command Prompt Via Batch File Tutorial'>More Windows Command Prompt Via Batch File Tutorial<\/a> 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&#8217;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 &#8220;ducking off&#8221; to the Internet to get some information, something that is fairly easy to do with Windows Batch programming.<\/p>\n<p><p>Would like to point out a few ideas:<\/p>\n<ul>\n<li><a target=_blank title='CHOICE information from computerhope.com ... thanks' href='http:\/\/www.computerhope.com\/choicehl.htm'>CHOICE<\/a> command<\/li>\n<li><a target=_blank title='CALL information from computerhope.com ... thanks' href='http:\/\/www.computerhope.com\/call.htm'>CALL<\/a> command<\/li>\n<li><a target=_blank title='START information from computerhope.com ... thanks' href='http:\/\/www.computerhope.com\/starthlp.htm'>START<\/a> and <a target=_blank title='EXIT information from computerhope.com ... thanks' href='http:\/\/www.computerhope.com\/exithlp.htm'>EXIT<\/a> commands<\/li>\n<li><a target=_blank title='DATE information from computerhope.com ... thanks' href='http:\/\/www.computerhope.com\/datehlp.htm'>DATE<\/a> \/T and <a target=_blank title='TIME information from computerhope.com ... thanks' href='http:\/\/www.computerhope.com\/timehlp.htm'>TIME<\/a> \/T commands<\/li>\n<li><a target=_blank title='Do you remember Tamagotchi?' href='http:\/\/en.wikipedia.org\/wiki\/Tamagotchi'>Tamagotchi<\/a> (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<\/li>\n<li>Use of CHOICE with a timeout could make this procedure one that keeps the computer awake (another method to do this can be an <a target=_blank title='AutoHotKey home' href='http:\/\/www.autohotkey.com'>Auto<\/a><a target=_blank title='AutoHotKey tutorials here' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=AutoHotKey'>HotKey<\/a> <a target=_blank title='Terminate and Stay Resident concept explained by Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Terminate_and_Stay_Resident'>stay-resident<\/a> procedure)<\/li>\n<li>The beep functionality (which is optional &#8230; see the IF NOT EXIST syntax) is achieved via echo @echo (Alt-7) &gt;beep.bat (ie. hold Alt and 7 (of the numeric keypad) together, as per advice within <a target=_blank title='beep.bat advice ... thanks' href='http:\/\/www.instructables.com\/community\/Batch-Beeps\/'>this webpage<\/a> &#8230; thanks)<\/li>\n<li>Use of Environment variables where, at all, possible eg. %ProgramFiles%<\/li>\n<li>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<\/li>\n<\/ul>\n<p>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 <a target=_blank title='ideas.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/index.bat_GETME'>index.bat<\/a>.<\/p>\n<p>Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to <a target=_blank title='More_Options.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/More_Options.bat_GETME'>More_Options.bat<\/a>.<\/p>\n<p>Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to <a target=_blank title='Show_Company_Report.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Show_Company_Report.bat_GETME'>Show_Company_Report.bat<\/a>.<\/p>\n<p>Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to <a target=_blank title='Feed_the_Fish.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Feed_the_Fish.bat_GETME'>Feed_the_Fish.bat<\/a>.<\/p>\n<p>Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to <a target=_blank title='Show_Task_List.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/Show_Task_List.bat_GETME'>Show_Task_List.bat<\/a>.<\/p>\n<p>Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to <a target=_blank title='beep.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/beep.bat_GETME'>beep.bat<\/a> which may not work as a download, in which case the instructions to create it are &#8230; echo @echo (Alt-7)&gt;beep.bat &#8230; Alt key and 7 from numeric keypad at the same time at a Windows Command Prompt in the correct directory &#8230; this file is optional.<\/p>\n<p>Enjoy this <a target=_blank title='Menu for Windows Command Prompt Via Batch File Tutorial' href='http:\/\/www.rjmprogramming.com.au\/Windows\/MenuBatch\/'>tutorial<\/a>.<\/p>\n<hr \/>\n<p id='pmwcpt'>Previous <a target=_blank title='More Windows Command Prompt Via Batch File Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=3571'>More Windows Command Prompt Via Batch File Tutorial<\/a> shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/\"><img decoding=\"async\" style=\"float: left; border: 15px solid pink;\" id='imgatimeline' onmouseover=\"var xqw=this.src; if (xqw.indexOf('9') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-1of.jpg'; } else if (xqw.indexOf('8') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-9of.jpg'; } else if (xqw.indexOf('7') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-8of.jpg'; }  else if (xqw.indexOf('6') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-7of.jpg'; }  else if (xqw.indexOf('5') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-6of.jpg'; }  else if (xqw.indexOf('4') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-5of.jpg'; }  else if (xqw.indexOf('3') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-4of.jpg'; }  else if (xqw.indexOf('2') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-3of.jpg'; }  else if (xqw.indexOf('1') != -1) { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-2of.jpg'; } else { this.src = 'http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-1of.jpg'; } \" alt=\"More Windows Command Prompt Via Batch File Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/Windows_Batch_More-6of.jpg\" title=\"More Windows Command Prompt Via Batch File Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')\" \/><\/a><p class=\"wp-caption-text\">More Windows Command Prompt Via Batch File Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')<\/p><\/div>\n<p>This tutorial builds on the previous <a title='Windows Command Prompt Via Batch File' href=\"#prevwbtut\">Windows Command Prompt Via Batch File<\/a> 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&#8217;d like to link you to <a target=_blank title='' href='http:\/\/users.cybercity.dk\/~bse26236\/batutil\/help\/STRINGS.HTM#bennylevel'>Strings<\/a> for some brilliant thoughts regarding this.   The date parsing ideas were from <a target=_blank title='Windows Batch File (.bat): Get Current Date as MMDDYYYY' href='http:\/\/www.tech-recipes.com\/rx\/956\/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format\/'>Windows Batch File (.bat): Get Current Date as MMDDYYYY<\/a> (thanks a lot).<\/p>\n<p>Here is some downloadable Windows Command Prompt Batch File programming source code which you could rename to <a target=_blank title='ideas.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/Batch\/ideas.bat_GETME'>ideas.bat<\/a> as you see fit (and hopefully don&#8217;t have a fit?!).<\/p>\n<hr \/>\n<p id=\"prevwbtut\">Previous Windows Command Prompt Via Batch File <a target=_blank title='Windows Command Prompt Via Batch File' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=351'>tutorial<\/a> below:<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/WindowsCommandPromptViaBatchFilePrimer\/iFrame.html\"><img decoding=\"async\" style=\"float: left; border: 15px solid pink;\" alt=\"Windows Command Prompt Via Batch File\" src=\"http:\/\/www.rjmprogramming.com.au\/WindowsCommandPromptViaBatchFilePrimer\/WindowsCommandPromptViaBatchFilePrimer.jpg\" title=\"Windows Command Prompt Via Batch File\" \/><\/a><p class=\"wp-caption-text\">Windows Command Prompt Via Batch File<\/p><\/div>\n<p><a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/WindowsCommandPromptViaBatchFilePrimer\/iFrame.html'>Tutorial<\/a> &#8230;<\/p>\n<p><strong><\/p>\n<p>Transcript:<\/p>\n<p><\/strong><\/p>\n<p>Do you own a Windows computer?<\/p>\n<p>Have you heard of Command Prompt, or MS-DOS, or the DOS prompt?<\/p>\n<p>It is like Bash Scripting on Linux or Korn Shell scripting on Unix<br \/>\n    and could open a whole new world of possibilities for your work<br \/>\n    in Windows.<\/p>\n<p>If you are a beginner you need to start slowly, and in this<br \/>\n    tutorial we will only do benign commands that, for the most part,<br \/>\n    read rather than write anything.<\/p>\n<p>We&#8217;ll do a bit of:<\/p>\n<p>cd<br \/>\necho<br \/>\ncd [place]<br \/>\ndir<br \/>\ntype<br \/>\nmore<br \/>\ntasklist<br \/>\nvol<\/p>\n<p>In your search engine look for &#8220;MS-DOS commands&#8221; for further<br \/>\n   information.   Once you see a command of interest, at<br \/>\n   Command Prompt you can type:<\/p>\n<p>help [command]<\/p>\n<p>&#8230; to find further information.<\/p>\n<p>So here goes &#8230; we will open the Command Prompt application &#8230; then run a preprepared<br \/>\n   Batch script &#8230; but just concentrate on its commands, rather than doing scripting<br \/>\n   &#8230; that is for later &#8230; at the end of the presentation the Batch script is typed<br \/>\n   out for you.\n<\/p>\n<p><strong>Let&#8217;s explore some more command prompt commands below on 20\/3\/2013 &#8230;<\/strong><\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/help-rename-find-copy.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Windows Command Prompt ... more\" src=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/help-rename-find-copy.jpg\" title=\"Windows Command Prompt ... more\" style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Windows Command Prompt ... more<\/p><\/div>\n<p><a target=_blank href='http:\/\/www.computerhope.com\/msdos.htm' title='Great MS-DOS Information Link'>Great Command Prompt Information Link<\/a><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d351' onclick='var dv=document.getElementById(\"d351\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?cat=60\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d351' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d3571' onclick='var dv=document.getElementById(\"d3571\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?cat=60\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d3571' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d4196' onclick='var dv=document.getElementById(\"d4196\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?cat=60\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d4196' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>For today&#8217;s tutorial we build a menu-driven Windows Batch (at Command Prompt window) , building on previous<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[119,236,358,770,818,997,1221,1319,1435],"class_list":["post-4196","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-automation","tag-command-prompt","tag-dos","tag-menu","tag-ms-dos","tag-programming","tag-supervision","tag-tutorial","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4196"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=4196"}],"version-history":[{"count":1,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4196\/revisions"}],"predecessor-version":[{"id":48675,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4196\/revisions\/48675"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=4196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=4196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=4196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}