Windows – compress file using command line windows, (making zip file, using only native tools)

cmd.execompressionwindows

I am looking for a command line command to comress a file.
I want to compress each file individually to filename.zip.

all the methods that I found including:
http://exchangeserverpro.com/powershell-script-iis-logs-cleanup/

and:

https://stackoverflow.com/questions/17546016/how-can-you-zip-or-unzip-from-the-command-prompt-using-only-windows-built-in-ca/26843122#26843122

are near by but not exactly what I need. any suggestion?
if it possible, I would like it to happen wthout external software (like 7-zip).
it can be a power shell script.

Best Answer

There is a single, simple cmd.exe command for this. (Through PowerShell v5.0+)

To zip:

powershell Compress-Archive -LiteralPath 'C:\mypath\testfile.txt' -DestinationPath "C:\mypath\Test.zip"

To unzip:

powershell Expand-Archive -LiteralPath "C:\mypath\Test.Zip" -DestinationPath "C:\mypath" -Force

Sources:

Special thanks to @Ramhound

Related Question