{"id":22042,"date":"2016-05-19T03:01:49","date_gmt":"2016-05-18T17:01:49","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=22042"},"modified":"2020-04-28T09:43:21","modified_gmt":"2020-04-27T23:43:21","slug":"windows-command-line-batch-quiz-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/windows-command-line-batch-quiz-primer-tutorial\/","title":{"rendered":"Windows Command Line Batch Quiz Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Windows\/quiz.JPG\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Windows Command Line Batch Quiz Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Windows\/quiz.JPG\" title=\"Windows Command Line Batch Quiz Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Windows Command Line Batch Quiz Primer Tutorial<\/p><\/div>\n<p>Readers who found <a title='Assembler Primer Tutorial' href='#apt'>Assembler Primer Tutorial<\/a> interesting may well be interested in today&#8217;s tutorial where we construct a simple quiz made up of questions suiting a <a target=_blank title='Hotkey related information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Keyboard_shortcut'><i>hotkey<\/i><\/a> answer on the Windows command line, written in DOS (or Windows Command Line) Batch.<\/p>\n<p>Ever since Microsoft Windows XP 64 bit operating system, and on, the Windows Command Line (or DOS) has had available to it the extremely useful command &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='DOS choice command information from computerhope' href='http:\/\/www.computerhope.com\/choicehl.htm'>CHOICE<\/a> [\/C choices] [\/N] [\/CS] [\/T timeout \/D choice] [\/M text]<br \/>\n<\/code><\/p>\n<p> &#8230; which allows for fairly sophisticated <i>hotkey<\/i> interactive input functionality.   However, we found on the net a really <a target=_blank title='Useful link' href='https:\/\/www.google.com.au\/search?q=detecting+key+pressed+by+if+errorlevel&#038;ie=utf-8&#038;oe=utf-8&#038;gws_rd=cr&#038;ei=27Q7V7CoCoiq0QSq2Zz4DQ#q=detecting+key+pressed+in+dos'>useful link<\/a> pointing to some clever DOS Batch code possibilities making use of &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='DOS debug command information from computerhope' href='http:\/\/www.computerhope.com\/debughlp.htm'>DEBUG<\/a> [[drive:][path]filename [testfile-parameters]]<br \/>\n<\/code><\/p>\n<p> &#8230; facilitating the writing of assembly code to come to the same <i>hotkey<\/i> capability CHOICE is capable of &#8230; but working for 32 bit &#8230; should that be your scenario &#8230; cute, huh?!<\/p>\n<p>The other cute thing about today&#8217;s DOS Batch is its use of &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='DOS ping information from computerhope' href='http:\/\/www.computerhope.com\/jargon\/p\/ping.htm'>ping<\/a> -n 2 127.0.0.1 &gt;nul<br \/>\n<\/code><\/p>\n<p> &#8230; to sleep for two seconds at various times.<\/p>\n<p>So if you are on Windows you could download <a target=_blank title='quiz.bat' href='http:\/\/www.rjmprogramming.com.au\/Windows\/quiz.bat_GETME'>quiz.bat<\/a> to try it out.  It includes the brilliance of Paul Tomasi&#8217;s <i>hotkey<\/i> functionality Assembler &#8230;<\/p>\n<p><code><br \/>\n   @rem ========================================<br \/>\n   @rem GETKEY.BAT - Written by Paul Tomasi 2010<br \/>\n   @rem<br \/>\n   @rem Waits for keypress. Returns key value<br \/>\n   @rem ========================================<br \/>\n   ::---------------------------<br \/>\n   :: GETKEY<br \/>\n   ::---------------------------<br \/>\n   :getkey<br \/>\n      (<br \/>\n         echo a<br \/>\n         echo mov ah, 08<br \/>\n         echo int 21<br \/>\n         echo mov ah, 4c<br \/>\n         echo int 21<br \/>\n         echo.<br \/>\n         echo rcx<br \/>\n         echo 08<br \/>\n         echo n getkey.com<br \/>\n         echo w<br \/>\n         echo q<br \/>\n      )&gt;script<br \/>\n      debug&lt;script&gt;nul<br \/>\n      call getkey.com<br \/>\n   goto :eof<br \/>\n<\/code><\/p>\n<p>To read a bit more about Assembler, and the, now, huge history its &#8220;story&#8221; spans, keep reading below and through to its links.  Another topic of interest, if all this interests you, would no doubt be <a target=_blank title='AutoHotKey tutorials here' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/autohotkey'>AutoHotKey<\/a>.<\/p>\n<hr>\n<p id='apt'>Previous relevant <a target=_blank title='Assembler Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/assembler-primer-tutorial\/'>Assembler Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/DOS\/Assembler\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Assembler Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/DOS\/Assembler\/MASM_Assembler.jpg\" title=\"Assembler Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Assembler Primer Tutorial<\/p><\/div>\n<p>Assembler programming is a very early form of software code, dating back as far as 1954, that sits, in the spectrum of computer language sophistication, between computer machine code and the compiled source codes of modern programming languages (which comparatively read like a story \u2026 good luck with Assembler stories \u2026 gobbleLITTLELESSgook?!), predating BASIC and FORTRAN. The Wikipedia page about compilers puts this in historical perspective \u201c<\/p>\n<blockquote><p>The first compiler was written by Grace Hopper, in 1952, for the A-0 programming language. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler in 1957.<\/p><\/blockquote>\n<p>\u201d Let\u2019s see some information about Assembler, from Wikipedia, below.<\/p>\n<blockquote><p>An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture&#8217;s machine code instructions. Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple architectures, but require interpreters or compiling.<\/p>\n<p>Assembly language is converted into executable machine code by a utility program referred to as an assembler; the conversion process is referred to as assembly, or assembling the code.<\/p>\n<p>Assembly language uses a mnemonic to represent each low-level machine operation or opcode. Some opcodes require one or more operands as part of the instruction, and most assemblers can take labels and symbols as operands to represent addresses and constants, instead of hard coding them into the program. Macro assemblers include a macroinstruction facility so that assembly language text can be pre-assigned to a name, and that name can be used to insert the text into other code. Many assemblers offer additional mechanisms to facilitate program development, to control the assembly process, and to aid debugging.\n<\/p><\/blockquote>\n<p>The tutorial shows some simple Assembler code in action for a <a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/DOS\/Assembler\/'>Hello World program<\/a> after seeing some slides regarding the install of MASM 32bit compiler of Assembler code.    Please take care if you go ahead installing MASM 32bit Assembler compiler, and, as mentioned several times with the install, do not proceed if there are even warning messages from the install, or, pretty obviously, if you do not have 32bit Windows as your operating system.<\/p>\n<p>Link to Assembler information &#8230; <a target=_blank title='Assembler programming information' href='http:\/\/en.wikipedia.org\/wiki\/Assembler_(computing)'>from Wikipedia from which quote above comes<\/a>.<br \/>\nLink to MASM32 SDK download website <a target=_blank title='Assembler programming information' href='http:\/\/www.masm32.com\/index.htm'>here<\/a> which installs an Assembler compiler for 32bit Windows.<br \/>\nLink to downloadable Assembler programming source code which is word for word from <a target=_blank title='Outputting Hello World in MASM using WIN32 Functions' href='http:\/\/stackoverflow.com\/questions\/4568306\/outputting-hello-world-in-masm-using-win32-functions'>Outputting Hello World in MASM using WIN32 Functions<\/a> and rename to <a target=_blank title='test.asm Assembler programming source code' href='http:\/\/www.rjmprogramming.com.au\/DOS\/Assembler\/test.asm_GETME'>test.asm<\/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='#d3529' onclick='var dv=document.getElementById(\"d3529\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?cat=42\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d3529' 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='#d22042' onclick='var dv=document.getElementById(\"d22042\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/dos\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22042' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Readers who found Assembler Primer Tutorial interesting may well be interested in today&#8217;s tutorial where we construct a simple quiz made up of questions suiting a hotkey answer on the Windows command line, written in DOS (or Windows Command Line) &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/windows-command-line-batch-quiz-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/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":[1884,47,108,135,234,305,319,358,885,997,1319,1435],"class_list":["post-22042","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-32-bit","tag-64-bit","tag-assembler","tag-batch","tag-command-line","tag-debug","tag-desktop","tag-dos","tag-operating-system-2","tag-programming","tag-tutorial","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22042"}],"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=22042"}],"version-history":[{"count":4,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22042\/revisions"}],"predecessor-version":[{"id":48852,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22042\/revisions\/48852"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=22042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=22042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=22042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}