可以使用 array 运算符创建包含零个或一个对象的数组。 例如:PowerShell 复制 $a = @("Hello World") $a.Count Output 复制 1 PowerShell 复制 $b = @() $b.Count Output 复制 0 获取对象时,数组运算符在脚本中很有用,但不知道预期数量。 例如:...
a=New-Object'object[,]'2,2# create a 2x2 array of anything$a[0,0] =10# set to an int value$a[0,1] =$false# set to a boolean value$a[1,0] ="red"# set to a string value$a[1,1] =10.50D# set to a decimal valueforeach($ein$a) {# enumerate over the whole array$e...
TheContextparameter doesn't change the number of objects generated bySelect-String.Select-Stringgenerates oneMatchInfoobject for each match. The context is stored as an array of strings in theContextproperty of the object. When the output of aSelect-Stringcommand is sent down the pipeline to anot...
Specifies, as a string array, the event log providers from which this cmdlet gets events. Enter the provider names in a comma-separated list, or use wildcard characters to create provider name patterns. An event log provider is a program or service that writes events...
Out-Printer Sends output to a printer. Out-String Sends objects to the host as a series of strings. Pop-Location Changes the current location to the location most recently pushed onto the stack. You can pop the location from the default stack or from a stack that you create by using the...
function Test-ValueFromPipelineByPropertyName{ param( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string[]]$ComputerName ) Write-Output -InputObject "Saw that ComputerName was '$ComputerName'" } Ezután egy objektum ComputerName tulajdonsággal való pipálásának bemutat...
在日常生活或者工作中的时候,我们偶尔会遇到这样一种让人头大的情况——当单个Excel文件较大或需要根据...
[-NonInteractive] [-NoProfile] [-OutputFormat {Text | XML}] [-PSConsoleFile <file> | -Version <version>] [-Sta] [-WindowStyle <style>] [-File <filePath> <args>] [-Command { - | <script-block> [-args <arg-array>] | <string> [<CommandParameters>] } ] PowerShell[.exe] -...
StaticType="System.Object[]"><Elements><StringConstantExpressionAst StringConstantType="SingleQuoted"StaticType="string">c</StringConstantExpressionAst><StringConstantExpressionAst StringConstantType="SingleQuoted"StaticType="string">AcA</StringConstantExpressionAst></Elements></ArrayLiteralAst></Binary...
While they are replaced with the actual values in the message text, a more robust way to access them is to retrieve the message with the Get-WinEvent cmdlet, and then use the Properties array of the message. Here’s an example of how this functionality can help unwrap a malicious attempt...