Skip to content

Instantly share code, notes, and snippets.

@joshschmelzle
Last active December 15, 2016 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshschmelzle/b43a914bc0316a54f477997277c76545 to your computer and use it in GitHub Desktop.
Save joshschmelzle/b43a914bc0316a54f477997277c76545 to your computer and use it in GitHub Desktop.
Copy win32 command line output to Windows Clipboard

To save the output of a command on the Windows clipboard, add a pipe* (|) operator to your command followed by the clip command.

Examples

dir | clip - copy the listing of current folder contents to the clipboard.

tree | clip - copy a recursive directory structure to the clipboard.

pwd | clip - copy the present working directory to the clipboard.

type notes.md | clip - place content of notes.md to the clipboard.

driverquery | clip - copy a listing of installed drivers to the clipboard.

sc query | clip - copy a list of services and their status to the clipboard.

Commands

Pipe

* This is a redirection operator which reads the output from one command and writes it to the input of another command. Also known as a pipe.

Clip

Redirects command output from the command line to the Windows clipboard. You can then paste this text output into other programs. Technet: Clip.

Syntax:

<Command> | clip
clip < <Filename>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment