In Windows, you can pipe 'clip' after a command to put the output into the clipboard, which is convenient.



When using Windows, you may need to copy and paste the output of a command, such as by running ipconfig to display network information, copying and pasting it to record or report it. In such cases, you can quickly copy and paste the output of a command by using the command 'clip'.

clip | Microsoft Learn
https://learn.microsoft.com/ja-jp/windows-server/administration/windows-commands/clip

Tip of the week: Use clip to pipe the output of your command to the clipboard
by u/jenmsft in Windows 11



The 'clip' command has the functions of 'saving the output of other commands to the clipboard' and 'saving the contents of a specified file to the clipboard.' This time, we will actually use the former function. Note that using clip with PowerShell, which comes standard with Windows, will result in garbled characters, so we recommend using it with the command prompt.

First, press the Windows key and the R key simultaneously to open the Run dialog box, enter 'cmd' and click 'OK.'



Once the command prompt is open, enter a command and press Enter to execute it. In this example, I wanted to 'save network information to the clipboard,' so I entered ' ipconfig | clip ' and pressed Enter. If you're using a Japanese keyboard, you can enter '|' by pressing the Shift key and the ¥ key at the same time. Also, there is a half-width space between 'ipconfig,' '|,' and 'clip.'



Once you run the command, the process will finish in a flash. Your network information will now be saved to your clipboard.



After that, just paste the network information into Notepad, a web input form, etc. To try it out, start Notepad and click 'Paste' in the right-click menu.



Then, the network information stored in the clipboard was entered into the notepad. By using clip, you can omit the operation of 'selecting and copying the network information displayed in the command prompt'.



Of course, clip works with commands other than ipconfig. Try running the command ' systeminfo | clip '.



The system information has been copied.



Furthermore, if you register a command such as 'save the output of command XX to the clipboard' to a shortcut, you can achieve the action of 'copying the desired information just by double-clicking the shortcut.' As an example, let's create a shortcut that copies network information just by double-clicking it.

First, right-click on the desktop, click 'New', and then click 'Shortcut'.



In the input field that says 'Enter the location of the item,' enter ' C:\Windows\System32\cmd.exe /c ipconfig | clip ' and click 'Next.'



Give the shortcut a name and click 'Done.' This completes the creation of the shortcut.



After that, you can copy the network information just by clicking the shortcut. You can also copy other information by rewriting the command part of the shortcut. For example, you can register the command ' C:\Windows\System32\cmd.exe /c echo [email protected] | clip ' to realize the action of 'copying an email address just by double-clicking.'



◆ Forum is currently open
A forum related to this article has been set up on the official GIGAZINE Discord server . Anyone can post freely, so please feel free to comment! If you do not have a Discord account, please refer to the account creation procedure article to create an account!

• Discord | 'Tell me some useful ways to use the clip command!' | GIGAZINE
https://discord.com/channels/1037961069903216680/1272845967930032159

in Review,   Software, Posted by log1o_hf