3

When I zip files within windows 10, I perform the following steps....

right click → Send to → Compressed (zipped) folder

I've been trying to replicate this command but I'm unable to figure out what windows is actually doing to build the .zip folder. I've tried many examples using powershell which it does zip a folder, but it doesn't seem to be the same default command used by windows.

What command is windows using to zip a folder?

Sir.Socks
  • 179
  • 1
  • 5
  • Check this - https://stackoverflow.com/questions/28043589/how-can-i-compress-zip-and-uncompress-unzip-files-and-folders-with-bat - there's no default command that performs zipping like the right-click ,but you can invoke it using the [zipjs.bat](https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/zipjs.bat) like in the answer. – npocmaka Apr 22 '20 at 14:51
  • Windows 10 also comes with `tar` now in case that's more your style – SomethingDark Apr 22 '20 at 15:37
  • 1
    This *Send To* context menu item is a file at `%AppData%\Microsoft\Windows\SendTo` with the name `Compressed (zipped) folder.ZFSendToTarget`; in the Windows Registry (`HKEY_CLASSES_ROOT`) you can look up the file extension (a key with the name `.ZFSendToTarget`) to find out what actually happens... – aschipfl Apr 22 '20 at 20:20

1 Answers1

2

In powershell you can use Compress-Archive -Path input.txt -DestinationPath output.zip or just Compress-Archive input.txt output.zip where input.txt can also be a folder. To call a powershell command from Windows Command Prompt add a "powershell" to the start of the command which in this case ou would use powershell Compress-Archive input.txt output.zip if you are going to use it in Windows Command Prompt. Yousaid that you were successful doing this in Powershell so just use the same syntax but with an added "powershell" at the beginning of the command in cmd.

For more information or if you are experiencing issues check https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-5.1 again