Datasets:
Memory: explorer-zip-selection-2
Overview
Compress a folder into a zip archive beside it, from a shell. Use this as the terminal
route to the same end state as the file manager's send-to-compressed action: one command
names the source folder and the archive to write. The recorded trace opens a shell, runs
Compress-Archive over the docs folder writing docs.zip next to it, and closes the
shell with exit.
Prerequisites
- A desktop environment with a file manager that can create archives, or a shell with an archiving tool.
- A folder or set of files to archive, existing and readable.
- Write access to the location where the archive is written, and enough free space for it.
- A decision about the archive's internal structure before starting: archiving a folder puts its name at the root of the archive, while archiving the folder's contents puts the files at the root. Both are reasonable and they produce different archives from the same source.
- The archive's name and location decided in advance. Tools that name the archive automatically derive it from the selection, which is not always the intended name.
- No existing archive at that path, or agreement that it may be replaced.
Steps
Step 1 — Left-click at (268, 1060)
The task is to compress a folder into a zip archive beside it, which PowerShell does in one command, so the first move is to open a shell. Left-click the PowerShell icon in the taskbar.
Step 2 — Type: Compress-Archive -Path $env:USERPROFILE\corpus-seed\docs -DestinationPath $env:USERPROFILE\corpus-seed\docs.zip
Type a Compress-Archive command to build the zip. It is PowerShell's built-in archiver, so nothing needs installing, and it produces the same kind of archive the Explorer right-click Compress action does. -Path names what goes in and -DestinationPath names the archive to write, both given in full so the result lands beside the source folder.
Step 3 — Press: Enter
After typing the command Press Enter to create the archive.
Step 4 — Type: exit
Type exit to close the shell.
Step 5 — Press: Enter
After typing the exit Press Enter to run it and close the window.
Notes & Edge Cases
- Archiving the folder and archiving its contents produce different archives. Naming the folder puts that folder at the root of the archive; naming everything inside it puts the files at the root. Both commands succeed, both produce a valid zip, and only one matches what the file manager's own compress action does. Decide which structure is wanted before running, and check by listing the archive afterwards.
- The file manager names the archive for you and the shell does not. A file-manager compress derives the name from the selection — which is the folder's name for a single folder, and the anchor file's name for a multi-file selection, a difference that surprises people. The shell requires the name, which is more typing and no ambiguity.
- The destination is refused if it already exists, unless a flag is added to overwrite. That refusal is useful; overriding it replaces an existing archive with no way back.
- The source folder is left untouched. Compressing does not consume or move anything.
- Paths are built from an environment variable rather than written literally, so the command does not depend on the account name.
- A large source takes real time and the prompt does not return until it finishes. Confirm the archive exists and has a plausible size rather than assuming completion from the command being accepted.




