{"id":612,"date":"2009-06-10T00:01:36","date_gmt":"2009-06-10T07:01:36","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=612"},"modified":"2009-05-31T10:09:28","modified_gmt":"2009-05-31T17:09:28","slug":"your-very-own-zip-file-creator-part-v","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=612","title":{"rendered":"Your Very Own ZIP File Creator, Part V"},"content":{"rendered":"<p>Yes, this is the last part, where I go totally nerdy and discuss how to create your own MKZIP command for building fresh, empty Compressed Folders at the command prompt in Windows.<br \/>\n<!--more--><br \/>\nSome review:<\/p>\n<p>I&#8217;ve discussed the raw content of an empty ZIP file, or Compressed Folder. How you can view that data using the <code>DEBUG<\/code> utility.<\/p>\n<p>Then, I showed you how to use <code>DEBUG<\/code> to create your own, empty ZIP file.<\/p>\n<p>Next, I showed you how to automate the process by creating text that can be fed into <code>DEBUG<\/code> to magically create an empty ZIP file.<\/p>\n<p>So now you have the tool used to create an empty ZIP file, but you need the command that does the job. To create that command, you need to build a batch file.<\/p>\n<p>I won&#8217;t bother discussing how batch files work or the technical nuances. Basically, here is the thing:<\/p>\n<p><code>@echo off<br \/>\nrem MKZIP, create a new zip file\/Compressed Folder<br \/>\nif \"%1\"==\"\" goto error<br \/>\ndebug < %USERPROFILE%\\commands\\zip-create.debug > nul<br \/>\necho %1 created.<br \/>\ngoto end<br \/>\n:error<br \/>\necho Specify the name of the ZIP file to create.<br \/>\necho Be sure to include the ZIP filename extension.<br \/>\n:end<\/code><\/p>\n<p>You must be very careful how you type line 5. That specifies the location of the <code>zip-create.debug<\/code> file. Above, I&#8217;m putting in my account&#8217;s <code>commands<\/code> folder. If you have it in another folder, specify the folder name.<\/p>\n<p>The folder <code>%USERPROFILE%<\/code> is your account&#8217;s main folder on the PC.<\/p>\n<p>I recommend creating the batch file using Notepad, unless you have a favorite text editor. Here&#8217;s how it looks on my computer:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/06\/notepad2.png\" alt=\"notepad2\" title=\"notepad2\" width=\"487\" height=\"234\" class=\"alignnone size-full wp-image-614\" srcset=\"https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/06\/notepad2.png 487w, https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/06\/notepad2-300x144.png 300w\" sizes=\"auto, (max-width: 487px) 100vw, 487px\" \/><\/p>\n<p>You need to save the file as a batch file, and you need to place it in a folder where you can have easy access to the file. What I did was to name the file <code>MKZIP.BAT<\/code>, modeling it after the <code>MKDIR<\/code> command to make a new folder (directory).<\/p>\n<p>After pressing Ctrl+S in Notepad, choose the proper folder. I saved my file in the <code>commands<\/code> folder. Then type <strong>MKZIP.BAT<\/strong> as the name. From the Save as Type drop-down list choose <em>All Files<\/em> \u2014 do not choose <em>Text Documents<\/em> or Windows automatically appends the <code>TXT<\/code> extension, which isn&#8217;t a good thing.<\/p>\n<p>After saving the command, you can run it! Assuming that nothing is screwed up, it should create a ZIP file for you like this:<\/p>\n<p><code>MKZIP batch2.zip<\/code><\/p>\n<p>Typing the above command at the command prompt on my PC creates a new Compressed folder named <code>BATCH2.ZIP<\/code>. That&#8217;s exactly what I wanted.<\/p>\n<p>Another problem you&#8217;ll encounter is that the command works only in the directory it lives in. To make the command work everywhere, you need to add its directory to the <em>search path<\/em>. On my PC, the <code>commands<\/code> folder is already on the search path, which is handy because that&#8217;s where I put the <code>zip-create.debug<\/code> file.<\/p>\n<p>I won&#8217;t bother going into search paths and directories at this point. That&#8217;s because I did warn you that this process would be nerdy and technical. Even so, I would recommend that anyone interested in exploiting the full power of their PC learn the command prompt or terminal shell.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, this is the last part, where I go totally nerdy and discuss how to create your own MKZIP command for building fresh, empty Compressed Folders at the command prompt in Windows.<\/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-612","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\/612","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=612"}],"version-history":[{"count":6,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/612\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/612\/revisions\/651"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}