Copy a List of File Names to the Clipboard
Pipe Get-ChildItem's Name property into Set-Clipboard (or dir /b into clip) to copy a clean file listing.
01Command
$ Get-ChildItem 'C:\Users\me\Documents' -File |
Select-Object -ExpandProperty Name | Set-Clipboard02What it does
Right-click copy in Explorer copies the files themselves, not their names — this one-liner gives you a plain text list instead. Add -Recurse for subfolders, or pipe FullName instead of Name when paths are needed. The cmd equivalent is dir /b 'C:\folder' | clip; combining with findstr lets you filter names before copying.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Set-ClipboardEvidence: Set-Clipboard places piped strings (e.g. file names from Get-ChildItem) onto the Windows clipboard.
- CLIP - SS64Evidence: clip.exe reads piped input onto the clipboard; dir /b | clip lists bare file names in cmd.
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Search inside text files and logs with regex, returning file, line number and match.