Is there a 7-Zip command line switch that prevents echoing file names on the screen when they are added to the archive?
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.
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,
Out-Null
C:\PS>my-create-7zip-function | out-null
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 .
>
/dev/null
In MS-DOS and cmd.exe you can redirect to NUL instead of a file. Thanks agnul for this hint.
cmd.exe
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.
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"