{"id":606,"date":"2009-06-08T00:01:48","date_gmt":"2009-06-08T07:01:48","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=606"},"modified":"2009-05-31T10:05:20","modified_gmt":"2009-05-31T17:05:20","slug":"your-very-own-zip-file-creator-part-iv","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=606","title":{"rendered":"Your Very Own ZIP File Creator, Part IV"},"content":{"rendered":"<p>Time to automate DEBUG to spew out a new ZIP file at will. Yes, this is nerdy and technical stuff. Proceed with caution!<br \/>\n<!--more--><br \/>\nThe DOS command line is modeled after the Unix command prompt. DOS does share some of the basic input\/output elements of Unix, including the ability to feed text into a program. The topic is I\/O redirection, and it&#8217;s kind of a lost art these days.<\/p>\n<p>From the last post, you recall that you could create an empty ZIP file using the <code>DEBUG<\/code> utility in DOS. The problem is that it requires a lot of typing. Computers are supposed to make things easier, so why not do all that typing just once and let the computer worry about repeating itself?<\/p>\n<p>The trick is to save your typing in a text file. You can then use I\/O redirection at the command prompt to feed your typing into the <code>DEBUG<\/code> utility, thereby instantly creating a ZIP file.<\/p>\n<p>Here is the text:<\/p>\n<p><code>e100 50 4B 05 06 00 00 00 00 00 00 00 00 00 00 00 00<br \/>\ne110 00 00 00 00 00 00<br \/>\nrcx<br \/>\n16<br \/>\nn new.zip<br \/>\nw<br \/>\nq<\/code><\/p>\n<p>Each line is a series of commands typed into <code>DEBUG<\/code>. The first two lines create the bytes needed for a raw ZIP file. The next two lines set the file size and name. The W writes the file, and \u2014 most importantly \u2014 the q quits <code>DEBUG<\/code>.<\/p>\n<p>Now I&#8217;ll tell you a secret: I actually didn&#8217;t type in all that stuff: I just copied and pasted it from the Command Prompt window straight out of <code>DEBUG<\/code>! I pasted it into a Notepad window:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/06\/notepad1.png\" alt=\"notepad1\" title=\"notepad1\" width=\"542\" height=\"192\" class=\"alignnone size-full wp-image-609\" srcset=\"https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/06\/notepad1.png 542w, https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/06\/notepad1-300x106.png 300w\" sizes=\"auto, (max-width: 542px) 100vw, 542px\" \/><\/p>\n<p>You should do the same: Copy and paste the text into Notepad. Then save the file to disk with the name <code>zip-create.debug<\/code>, or whatever name you choose. The name doesn&#8217;t matter, but remembering the name \u2014 and the file&#8217;s location \u2014 is important.<\/p>\n<p>The file location is important because you&#8217;re going to use this file later as part of a batch file. It&#8217;s the batch file that&#8217;s going to make creating the <code>MKZIP<\/code> utility possible. For now, you&#8217;re just automating the way <code>DEBUG<\/code> can be used to create a ZIP file.<\/p>\n<p>By the way, I create and save all my batch files, and scripts like <code>zip-create.debug<\/code>, in a folder called <code>commands<\/code>, located right off my account folder in Windows. You might consider creating a similar folder for the account folder on your PC.<\/p>\n<p>After saving the file, you can use it to create a ZIP file. Follow these steps:<\/p>\n<p>1. Open a command prompt window.<\/p>\n<p>2. Navigate to the folder where you saved the <code>zip-create.debug<\/code> file.<\/p>\n<p>See? I told you that you&#8217;d need to remember where you saved that file. At the command prompt, the <code>CD<\/code> command is used to change folders (directories). If you&#8217;re totally lost now, then you&#8217;re totally lost; keep reading anyway.<\/p>\n<p>3. Type <strong>DEBUG < zip-create.debug<\/strong> and press the Enter key.<\/p>\n<p>(If you see an error message, then you&#8217;re not in the proper folder.)<\/p>\n<p>The text from the <code>zip-create.debug<\/code> file is spewed into <code>DEBUG<\/code> just as if you typed it yourself. The end result is a new ZIP file named <code>NEW.ZIP<\/code>.<\/p>\n<p>Of course, it isn&#8217;t really hard to keep recreating the <code>NEW.ZIP<\/code> file. The end result of my efforts was to create an <code>MKZIP<\/code> command. To do that, you need to employ batch files, which is the topic of Wednesday&#8217;s post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time to automate DEBUG to spew out a new ZIP file at will. Yes, this is nerdy and technical stuff. Proceed with caution!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-606","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=606"}],"version-history":[{"count":6,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/606\/revisions"}],"predecessor-version":[{"id":648,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/606\/revisions\/648"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}