In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to solve errors when using Format-Table to display output information. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
When we use Format-Table to display output information, we usually find that if a property field is long, it cannot be displayed properly, as shown below.
PS > Get-Process-Name powershell | Format-Table-Property Company,Name,Id,Path-AutoSizeCompany Name Id Path- Microsoft Corporation powershell 2836 C:\ Program Files\ Windows PowerShell\ v1.
An important detail involved in this is that the Format-Table command assumes that the closer the attribute is to the beginning of the attribute list, the more important it is. Therefore, it attempts to fully display the properties closest to the beginning of the list. If the Format-Table command cannot display all properties, it removes some columns from the display and issues a warning. If you make the name the last attribute in the list, you can see this behavior:
PS > Get-Process-Name powershell | Format-Table-Property Company,Path,Id,Name-AutoSizeWARNING: column "Name" does not fit into the display and was removed.Company Path Id--Microsoft Corporation C:\ Program Files\ Windows PowerShell\ v1.0\ powershell.exe 6
You can also automatically wrap longer Format-Table data in its display column by using the Wrap parameter. Using only the Wrap parameter does not necessarily achieve the desired operation, because if you specify AutoSize differently, it uses the default settings:
PS > Get-Process-Name powershell | Format-Table-Wrap-Property Name,Id,Company,PathName Id Company Path---- powershell 2836 Microsoft Corporati C:\ Program Files\ Wi on ndows PowerShell\ v1.0\ powershell.exe
One advantage of using the Wrap parameter is that it basically does not slow down the process. If you perform a recursive file list on a large directory system, then if you use AutoSize, it may take a lot of time and memory to display the first output items.
If you don't care about the system load, then a combination of AutoSize and Wrap parameters will work well.
PS > Get-Process-Name powershell | Format-Table-Wrap-AutoSize-Property Name,Id,Company,PathName Id Company Path---- powershell 2836 Microsoft Corporation C:\ Program Files\ Windows PowerShell\ v1.0\ powershell.exe
If you specify the widest column first, some columns may not be displayed, so the safest thing to do is to specify the smallest data element first. In the following example, we first specify a particularly wide path element, even using automatic line wrapping, but still lose the last name column:
PS > Get-Process-Name powershell | Format-Table-Wrap-AutoSize-Property Path,Id,Company,NameWARNING: column "Name" does not fit into the display and was removed.Path Id Company---- C:\ Program Files\ Windows PowerShell\ v1.0\ powershell.exe 2836 Microsoft Corporation about how to solve errors when using Format-Table to display output information. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.