是否有一个 7-Zip 命令行开关可以防止文件名在添加到存档时回显到屏幕上?
5 回答
Not built in, but if you add
<7z command here> 2>&1 NUL
to the end of your command-line, it will redirect all the output into the null device and stops it echoing to the screen. This is the MS-DOS equivalent of
2>&1 /dev/null
in Linux and Unix systems.
7-Zip 对此没有开关。如果您使用 PowerShell 调用 7-Zip,您可以使用Out-Null
. 例如,
C:\PS>my-create-7zip-function | out-null
If it doesn't have one, you can still redirect the output using >
into a file, then deleting the file afterwards. If you are on *nix, you can redirect into /dev/null
.
Edit
In MS-DOS and cmd.exe
you can redirect into NUL, instead of a file. Thanks to agnul for this hint.
AFAIK, there is not a switch for that, but you could hide the output redirecting it to a file, for example (DOS batch):
7z.exe ... normal parameters > DumpFile.txt
This way all the output ends in DumpFile.txt and not on the screen.
为避免文件名在屏幕上回显并仅显示确认信息,请执行以下操作:
...\right_path\7z a output.zip folder_to_be_compressed | findstr /b /r /c:"\<Everything is Ok" /c:"\<Scanning" /c:"\<Creating archive"