-1

I want to zip a folder structure from a batch file on the windows server. Lets say Structure is Like D:/DBA/ and inside DBA there are many folders with files and in DBA folder also there are files. Now i Want to Zip this DBA Folder and all folders and files inside it.

Kindly suggest how can i achieve this from a batchfile. Thanks in advance

DrCopyPaste
  • 4,023
  • 1
  • 22
  • 57
  • too little data and too many possibilities. Are you looking for a "normal" cmd-file or a powershell one? What program shall be used for zipping? What did you try yourself already? – DrCopyPaste May 12 '14 at 13:25
  • Kindly Execuse. I am using a batch file (Not powershell) to zip the folder as mentioned. I want to do this on the Windows server where No additional softwares like 7 zip etc are installed. – user3510083 May 12 '14 at 13:28

3 Answers3

1

Multiple forums suggest that the zip functionality built into Windows is provided by dlls for which there is no command line argument. For example:

The unzipping is a function of `zipfldr.dll`, so would use `regsvr32.exe` to invoke it, and as far as I know there are no arguements you can add to it for unzipping via batch file.

I would recommend a third party program, of which there are many (which you could provide along with a script): 7zip, winzip, pkzip, etc.

Also you might want to look into below as alternatives to batch files:

VBScript: Windows' built-in ZIP compression to be scripted

Community
  • 1
  • 1
Sunny
  • 7,812
  • 10
  • 34
  • 48
0

It's not possible without a third-party zip tool. Windows does not include a command-line zip tool.

nobody
  • 19,814
  • 17
  • 56
  • 77
0

It's not possible, as Windows Server doesn't have ZIP-compatible archiver. As a "built in" option, you can check Windows Server Resource Kit Tools download, which contains compress.exe tool, but it's not compatible with .zip format. Another option is to use 7zip standalone (7za) executable, which doesn't need to be installed and works "out of the box".

Gabriel M
  • 710
  • 4
  • 7