Sets working directory for temporary base archive. By default, 7-Zip builds a new base archive file in the same directory as the old base archive file. By specifying this switch, you can set the working directory where the temporary base archive file will be built. After the temporary base archive file is built, it is copied over the original archive and then temporary file is deleted.
-w[{dir_path}]
Specifies the destination directory path. It's not required that a path ends with a backslash.
If <dir_path> is not assigned, then 7-Zip will use Windows temporary directory.
7z a -tzip archive.zip *.cpp -wc:\temp
adds *.cpp files to archive.zip archive creeating temporary archive in c:\temp folder.