7-Zip CLI Switch for UTF-8 stdout Log Output
Managing console output in the 7-Zip command-line interface (CLI) is essential for automated scripting, log parsing, and multi-language file processing. This article explains which switches control output encoding and stream destinations in 7-Zip, specifically focusing on how to route detailed log messages directly to standard output (stdout) formatted in UTF-8.
To send log output directly to stdout in UTF-8 format
using the 7-Zip CLI, you combine the character set switch with the
stream redirection switch:
-sccUTF-8: Sets the console input and output character set to UTF-8.-bso1: Explicitly directs standard operational and log output tostdout(stream 1).
The Primary Encoding
Switch: -sccUTF-8
By default, 7-Zip on Windows uses the OEM (DOS) character encoding
for console input and output. To ensure that file names, paths, and log
entries are printed in UTF-8, use the -scc switch:
-sccUTF-8
This tells the 7-Zip engine to encode all standard terminal output in UTF-8, preventing character corruption when archiving or listing items with non-ASCII or Unicode names.
Directing Log Streams:
-bso and -bb
7-Zip separates its console stream types into standard messages
(-bso), progress information (-bsp), and error
messages (-bse).
-bso1: Ensures standard logs and information messages flow directly tostdout.-bb[0-3]: Controls the log detail level. Setting-bb3provides the most detailed per-file operation logging.
If you want clean log output routed to stdout without
progress bars interfering, redirect progress to stderr
(-bsp2) or disable it entirely (-bsp0).
Complete Command Example
To create an archive with full logging sent directly to
stdout in UTF-8 encoding while suppressing progress
noise:
7z a archive.7z /path/to/files/ -sccUTF-8 -bso1 -bsp0 -bb3For extracting files with UTF-8 log output piped to another tool:
7z x archive.7z -o/destination/ -sccUTF-8 -bso1 -bb1By pairing -sccUTF-8 with -bso1, any
external process capturing stdout receives clean,
accurately encoded UTF-8 logs.