I want to compress a folder and its all content through command line. It should be similar to when we compress some folder in windows 7 64 bit. 
By right click any folder -> send to -> compress folder.
Is there an equivalent to above process of compressing using command line. I want it through command line as I want to create an batch file.
I can't use any third party tools.
            Asked
            
        
        
            Active
            
        
            Viewed 3,490 times
        
    0
            
            
         
    
    
        Mandar Pande
        
- 12,250
- 16
- 45
- 72
 
    
    
        Jash
        
- 942
- 4
- 17
- 40
- 
                    Check the answers to [this question](http://stackoverflow.com/q/1153126/1630171). – Ansgar Wiechers Sep 04 '12 at 11:05
- 
                    also, this is with vbscript: http://stackoverflow.com/questions/2888972/write-to-file-using-copyhere-without-using-wscript-sleep check the top answer – SeanC Sep 04 '12 at 20:44
2 Answers
1
            
            
        Nativelty? No, but you can use things like 7-Zip which has command line utilities. 7-Zip is free by the way, and does not need to be installed.
Well, I found a few things you could try with PowerShell:
https://serverfault.com/questions/18872/how-to-zip-unzip-files-in-powershell/201604#201604
This has Command Line and PowerShell solutions :
- 
                    
- 
                    
- 
                    the last link does not require powershell nor 7 zip and is what you are looking for. I implemented it in some scripts but be aware that it is very hard to detect when the compression is finished. – jolivier Sep 04 '12 at 12:40
- 
                    @jolivier I was actually referencing the answer by "Beaner" in the last link which is Powershell but I wasn't really specific, thanks for point it out. – Delorean Sep 04 '12 at 13:44
0
            
            
        try compact or zip. Compact creates a compressed file while zip is identical to what you are doing folder -> send to -> compress folder
 
    
    
        Anthony
        
- 1
- 
                    Please provide a code example since OP indicated wanting to run the compression from the command line. – Jay Walker Mar 21 '13 at 17:11
 
    