System Environment:
Requirement: because it is used as a server and does not want to install any third-party software, you have to compress files or folders using the commands that come with windows.
Solution Process:
Usually we use the c: \ Documents ents and Settings \ Root \ sendto \ compression (zipped) folder function to compress, but you can see that this is onlyExplorer Shell Command. For more information, see the original article link.
Because it is not an executableProgramSo we cannot directly call it in cmd, and it seems that the progress cannot be achieved.
Has been installed by default since Windows 98..If you have the idea, start solving it.
Write a vbs script, Zip. vbs
Set objargs = wscript. argumentszipfile = objargs (0) 'create empty ZIP file and open for addingcreateobject ("scripting. fileSystemObject "). createtextfile (zipfile, true ). write "Pk" & CHR (5) & CHR (6) & string (18, vbnullchar) set zip = Createobject ("shell. application "). namespace (zipfile) 'add all files/directories to. zip filefor I = 1 to objargs. count-1 zip. copyhere (objargs (I) wscript. sleep 10000' Required !! (Depending on file/DIR size) Next
Call scripts
Cscript zip. vbs target.zip sourcefile1 sourcedir2
Instance:
Of course, if you are more lazy, you can write a bat processing script to directly write the file to be compressed and double-click it to run it.
Example: Zip. bat
Set src = D: \ src.txt set tar = D: \ tar.zip echo 'in in ZIP files 'cscript D: \ zip. vbs % tar % SRC % echo 'success 'pause
Reference link:
Windows built-in zip instruction http://filext.com/faq/compressed_zip_folder.php
Vbs script http://superuser.com/questions/110991/can-you-zip-a-file-from-the-command-prompt-using-only-windows-built-in-capabili