7-zip command line switch

Is there a 7-Zip command line switch that prevents echoing file names on the screen when they are added to the archive?

+6
7zip
source share
5 answers

Not built in, but if you add

<7z command here> 2>&1 NUL 

to the end of your command line, it redirects all output to a null device and stops its echo on the screen. This is the equivalent of MS-DOS

 2>&1 /dev/null 

on Linux and Unix systems.

+6
source share

The 7-Zip does not have a switch for this. If you use PowerShell to call 7-Zip, you can redirect the output to zero using Out-Null . For example,

 C:\PS>my-create-7zip-function | out-null 
+2
source share

If it does not have it, you can redirect the output with > to the file, and then delete the file after that. If you are on * nix, you can redirect it to /dev/null .

Edit

In MS-DOS and cmd.exe you can redirect to NUL instead of a file. Thanks agnul for this hint.

+1
source share

AFAIK, there is no switch for this, but you can hide the output redirecting it to a file, for example (DOS package):

 7z.exe ... normal parameters > DumpFile.txt 

Thus, all output ends on DumpFile.txt, and not on the screen.

0
source share

To avoid duplicate file names on the screen and display only confirmations, follow these steps:

 ...\right_path\7z a output.zip folder_to_be_compressed | findstr /b /r /c:"\<Everything is Ok" /c:"\<Scanning" /c:"\<Creating archive" 
0
source share

All Articles