Zip a file command line windows




















Report abuse. Details required :. Cancel Submit. Hi Martzx, Thank you for posting your query on Microsoft Community. Try to run the command mentioned below from command prompt and see if it helps you to zip file. Select Command prompt Admin from the list. Type the command mentioned below. How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site. That's a handy trick to know. It won't copy empty folders so be careful. OpenTextFile target, 2, vbtrue ' this is the header to designate a file as a zip zip. NameSpace source. Items If objItem. GetFolder objItem. Path ' if this folder is empty, then skip it as it can't compress empty folders If objFolder. NameSpace target. Count wscript. WSkid WSkid 4 4 bronze badges. Looks promising, but I got an "Object required: 'objApp.

I have the same problem. The above code doesn't work, or needs some extra stuff in the system the poster forgot to mention. It uses WScript vbs environment and several Shell objects. All were installed by default in Windows XP business?

Perhaps they are longer there for Win8? But what would be the advantage to this approach? Why not just write the PowerShell script to a fixed file and let it accept parameters? I tried all the other solutions. The most important advantage is use of powershell's native commands and no need to create the old-tech VBScript.

This worked for me on an old corporate windows7 laptop in Can be run direct from CMD, no need to create. Here is a great link that shows how to zip a file using windows native commands. Community Bot 1. LostUser LostUser 27 2 2 bronze badges. You should include the instructions in your answer. If the links go stale, your answer will be worthless NameSpace target for each item in sourceFolderObj.

IsFolder then if item. CopyHere item ' wait until the file appears in the ZIP file, ' this is needed because CopyHere returns immediately after starting an asynchronous copy process ' starting multiple asynchronous copy will not work as it causes error messages, an invalid ZIP file, ParseName item.

Name is nothing WScript. Nice work; I've been in a situation a few times where I'm not allowed to run non-whitelisted exes, I'll keep this in my toolbox, with a small modification of an argument to overwrite or add to existing file.

This is an old question, but it's relevance is still current. Dwight Wilbanks Dwight Wilbanks 19 1 1 bronze badge. CreateObject "Scripting. Compress-Archive relies upon the Microsoft. You can use the following command: zip -r nameoffile. MitulP91 MitulP91 1, 1 1 gold badge 11 11 silver badges 24 24 bronze badges.

The command zip is not recognized as internal or external command. Can you suggest me in windows XP? This will not be platform independent. I think OP wants to do it using java. The zip Package should be installed in system. ELinuxbook ELinuxbook 95 2 2 bronze badges. I assume that works on Linux, but it doesn't work on Windows. Of course, the OP didn't mention which operating system he was using. Michal Sipek Michal Sipek 6 6 silver badges 17 17 bronze badges.

The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related



0コメント

  • 1000 / 1000