&, call the operator.
Syntax: & <executable file path> [<parameter list>]
For example:
$execArgs="-upload ftp://u:p@ip:21 "
$execArgs=$execArgs+"-remotepath=`"/`" "
$execArgs=$execArgs+"-localpath=`"d:\123\`" "
& $execPath $()
This is an example of how we called flashfxp to upload files before, which is to use the & call character.
Point (.), multifunctional operator.
1. Call external PS1 script file
2. Member operators
3. Path operator
One point (.) represents the current directory, and two points (..) represent the upper directory.
For example: .\test.ps1, ..\PowerShell\test.ps1, these two expressions refer to themselves relative to D:\PowerShell\test.ps1.
Two points (..), range operator.
This is exactly the same as the two points above representing the upper directory, but the use is different.
"1..5" means 1 to 5, and "5..1" means 5 to 1.
When we are programming, we may use similar usages when using foreach:
Write-Host $i;
}
Double colon (::), static member operator.
When programming PowerShell, classes, their properties and methods in .NET are often used. For example, if the () method is called in PowerShell, it is called in the following way.
(-f), format operator.
Syntax: Format string -f value 1, value 2,...
Example: "{0} {1:N} {2,-10}" -f 10000,[math]::pi,"good"
$(), subexpression operator.
Calculating the value of an expression in brackets is a bit like the eval() function. If the value is a result, the scalar is returned. If the values are multiple, an array is returned.
For example:
#Return value 1000
$($i*5);
#Return an array of objects on a logical disk
$(Get-WMIObject win32_LogicalDisk)
@(), array subexpression operator.
Return the result of one or more statements through an array. If there is only one item, the array has only one member. like:
Comma (,) array element operator.
When this operator is used as a binary operator, commas are used to create an array, listing the individual elements of the array. like:
When used as a unary operator, commas are used to create an array containing only one member. like: