Home > Article > Backend Development > An example of PowerShell failure due to improper official translation_PHP Tutorial
Today I saw an article on PowerShell.com about the application of Gridview. I thought it was pretty good and decided to try it myself. . But it failed in actual operation, and then a long troubleshooting process began.
http://powershell.com/cs/blogs/tips/archive/2012/01/13/create-own-driver-tool.aspx
First, let’s run it. The error is as follows, saying that the field "Status" already exists. What the hell is this?
In the command, a parameter
ConvertFrom-Csv is used, which will format the data into csv style, which is the default "," Separate, but it also has a requirement, that is, the same columns cannot appear.
Let’s run it directly without processing the data to see what’s going on...
What the hell are these two "states"?
Find an English version of the machine and run it to see what is going on. It turns out that Microsoft translated both state and status into status.
Here, state should be a verb and status is a noun. There is still a difference between them, but they can indeed be translated into Chinese "status". Although the translation works, it does not comply with the rules of PowerShell. This article was written in 2012. This year, Microsoft has not discovered this problem. (I think one translated as status and the second translated as situation is more appropriate here.)
Now that this is the case, I Changed the method to execute in Chinese environment. As follows:
means adding a parameter and giving it a subtitle. Of course, you can also use out-file and then import-csv.
1 | Driverquery.exe /v /FO CSV |Convertfrom-csv -Header "模块名","显示名称","描述","驱动程序类型","启动模式","状态","状态s","接受停止","接受暂停","分页池(字节)","代码(字节)","BSS(字节)","链接日期","路径","Init(字节)"|select "模块名","显示名称","描述","驱动程序类型","启动模式","状态","状态s","接受停止"|Out-GridView -title "装逼大师" |
Looking at the results, the first line is not what I want, but the rest of the content is OK, so the requirements are basically fulfilled.
Microsoft cloud solution high-end top group [236804566] shares the road to becoming a great player