Windows – 7zip: compress and copy to destination folder

7-zipcommand linecompressionwindowszip

I am trying to do the following: command line compress a file from C:\TestFolder\file.txt (source location) and on the same command or bat file put that compressed file in (a destination folder) C:\DestinationFolder\file.7z.

My scenario applies to our real life point of sale system. We have an .mdb file that lives in a folder in the C:\ and I need to compress and copy the compressed file to a destination folder in the C:\. However, we do not want anything to occur to the original .mdb file in the source folder.

Let me know if I need to further clarify.

Best Answer

Compress and copy to destination folder

Use the following command:

7z a C:\DestinationFolder\file.7z c:\file.mdb

Notes:

  • a is add
  • See link below for the full manual for the command line version of 7z.

Further reading

Related Question