- AWS Tools for PowerShell 6
- Ramesh Waghmare
- 312字
- 2021-07-15 17:09:14
Working with output
As you work with PowerShell, sending out output and controlling the formatting of the output is very easy. Redirecting output is also a common use of the Pipe (|) operator that you find in PowerShell. There are different ways to deal with the output of the commands. As highlighted earlier, you can use the Format-List and Format-Table cmdlet to get the required properties in the output. In case you want to save the output to the file, you can use the out-file or export-csv parameter with the cmdlet. For example, let's say you want to save the services output to the file, then you simply use this:
PS C:\>Get-Service | out-file C:\services.txt
Or you use this:
PS C:\>Get-Service | export-csv C:\services.txt
One of the best things that you can find in PowerShell is called a grid view. It allows you to output the data to the GUI where you can work with it a little bit easier, especially when you are looking to manipulate data and get a quick peek on what's going on in a particular server or what's happening with a particular cmdlet. Out-GridView offers a great alternative instead of trying to figure out how to output to a file or a different table:
PS C:\>Get-Service | Out-GridView
This will just display the default properties into the grid view and not all the properties. But wait, you cannot combine Out-GridView with the Format-List and Format-Table commands. If you want to control what parameters go into the grid view, then the Select-Object cmdlet is what comes to the rescue:
PS C:\>Get-Service | Select-Object DisplayName,Status | Out-GridView
If you want all the parameters to send to the grid view, then you can use this:
PS C:\>Get-Service | Select-Object * | Out-GridView
If you are looking to get the quick details, then the grid view is the way to go.
- TestNG Beginner's Guide
- The Computer Vision Workshop
- Quarkus實(shí)踐指南:構(gòu)建新一代的Kubernetes原生Java微服務(wù)
- Troubleshooting PostgreSQL
- SQL Server 2016數(shù)據(jù)庫應(yīng)用與開發(fā)
- Babylon.js Essentials
- Statistical Application Development with R and Python(Second Edition)
- 智能手機(jī)APP UI設(shè)計(jì)與應(yīng)用任務(wù)教程
- Spring Security Essentials
- Node.js 12實(shí)戰(zhàn)
- Mastering Unreal Engine 4.X
- Android項(xiàng)目實(shí)戰(zhàn):博學(xué)谷
- OpenStack Sahara Essentials
- 軟件自動(dòng)化測(cè)試實(shí)戰(zhàn)解析:基于Python3編程語言
- Learning IBM Bluemix