If you are a PowerShell user, you probably are a big fan of the export-csv when you need to create a CSV file. We can use the same principles to copy the output content of any given PowerShell cmdlet output to the clipboard automatically. You can also move the output of a PowerShell cmdlet to the clipboard directly by adding | clip at the end of your cmdlet.
We can start simple, and get a list of all .exe files from the Windows folder and we are going to list their names and date of creation, as follows:
Now, if we add the | clip at the end, we can open notepad and just paste (Ctrl +V), as depicted in the image below. Note that when using clip there is no output in the PowerShell session.
Pretty neat, right? This should give you some ideas on how to use this tip in your day-to-day duties.
Featured image: Pixabay / TechGenix Illustration
More PowerShell Basics articles
- Creating Hyper-V VMs from a CSV file with PowerShell
- PowerShell Quick Tip: Consistent output in Azure Automation Accounts
- PowerShell parameters: Controlling the input of your scripts
- Color-coding PowerShell operating system health reports
- WMI or CIM in your PowerShell scripts: Which should you use?