How to zip a file using cmd line? Ask Question. Asked 8 years, 5 months ago. Active 5 months ago. Viewed k times. I want to zip a directory using the batch file command Windows XP batch file.
Like that I want a command line batch to zip a directory. Anonymous2 5 5 5 bronze badges. Your question is unclear. Why do you need to use the command line? In what context do you want to use the command - because you tagged this question with Java AND Flex? On Windows? Add a comment. Active Oldest Votes. Bigxiang Bigxiang 5, 3 3 gold badges 20 20 silver badges 20 20 bronze badges. I am using windows Xp can u suggest?
Without adding the path, by calling the. Shrikant Verma Shrikant Verma 1 1 silver badge 3 3 bronze badges. 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. NameSpace InputFolder. Items objShell. NameSpace ZipFile. CopyHere source 'Required! Welcome to Super User!
This is obviously a complicated script. Could you explain what it does, and how to use it? KyleMit 4, 7 7 gold badges 37 37 silver badges 51 51 bronze badges. Please expand your answer - it relies much too heavily on a link that may die anytime. If it dies - they die together — jitbit. Zimba Zimba 6 6 silver badges 11 11 bronze badges. The Overflow Blog.
Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 0. Related 0. Viewed k times. Improve this question. I'm not entirely sure why this question is closed. This comes up frequently in the form of "How do I compress my logs? The question could be rephrased to be narrower, I suppose, but the solutions are general. Not sure why this is closed as its the first hit on google for "windows zip" — AlSki.
On Windows 7 you can also use compact — jyz. Show 1 more comment. Active Oldest Votes. Parameter List: -R Rename compressed files. This is default compression. Source Source file specification. Wildcards may be used. Destination Destination file path specification.
Destination may be a directory. If Source is multiple files and -r is not specified, Destination must be a directory. Improve this answer. Peter Mortensen 2, 5 5 gold badges 23 23 silver badges 24 24 bronze badges. Bryan Bryan 7, 14 14 gold badges 67 67 silver badges 92 92 bronze badges. Wrong link! Correct links is: microsoft. Can this be used on windows server , too? This is a far cry from a usable ZIP client. You cannot compress folders and there appears to be no way to add compressed files to an existing archive.
Anyone else get "The compressed Zipped folder is invalid or corrupted" when you double-click the file compressed with this method? Compress isn't actually a ZIP client.
0コメント