Fix typos

This commit is contained in:
Marcello 2021-09-20 19:35:32 +02:00
parent 76550dfa3c
commit 5c0799df7f
118 changed files with 1150 additions and 1602 deletions

View file

@ -17,8 +17,8 @@ New-Item -ItemType SymbolicLink -Path .\link -Target .\Notice.txt # create a sy
Move-Item -Path <source> -Destination <target> # move and/or rename files and folders
Copy-Item -Path <source> -Destination <target> # copy (and rename) files and folders
Test-Path "path" -PathType Container # check if the exising path exists and is a folder
Test-Path "path" -PathType Leaf # check if the exising path exists and is a file
Test-Path "path" -PathType Container # check if the existing path exists and is a folder
Test-Path "path" -PathType Leaf # check if the existing path exists and is a file
# start, list , kill processes
Start-Process -FilePath <file> # open a file with the default process/program

View file

@ -47,7 +47,7 @@ $a, $b = $b, $a
# Interpolation
Write-Host "text $variable" # single quotes will not interpolate
Write-Host (<expresion>)
Write-Host (<expression>)
```
### Built-in Variables
@ -80,10 +80,10 @@ $List = @() # Empty List
$String = $List -join 'separator'
$List = $String -split 'separator'
# List comprhensions
# List comprehensions
$List = sequence | Where-Object {$_ command} # $_ is current object
$Dict = @{"a" = "apple"; "b" = "ball"} # Dict definition
$Dict["a"] = "acron" # Item update
$Dict["a"] = "acorn" # Item update
# Loop through keys
foreach ($k in $Dict.keys) {
@ -127,16 +127,16 @@ switch(variable) {
# syntax
switch [-regex|-wildcard|-exact][-casesensitive] (<value>)
{
"string"|number|variable|{ expression } { statementlist }
default { statementlist }
"string"|number|variable|{ expression } { statement_list }
default { statement_list }
}
# or
switch [-regex|-wildcard|-exact][-casesensitive] -file filename
{
"string"|number|variable|{ expression } { statementlist }
default { statementlist }
"string"|number|variable|{ expression } { statement_list }
default { statement_list }
}
```
@ -155,7 +155,7 @@ foreach (item in iterable) {
}
while (condition) {
# Code heer
# Code here
}
do {
@ -251,7 +251,7 @@ function Func {
```ps1
$args # array of passed arguments
$args[$index] # access to the argumnets
$args[$index] # access to the arguments
$args.count # number of arguments
```
@ -261,7 +261,7 @@ In `scripts.ps1`:
```ps1
param($param1, $param2, ...) # basic usage
param($param1, $param2=defvalue, ...) # with dafault values
param($param1, $param2=defvalue, ...) # with default values
param([Type] $param1, $param2, ...) # specify a type
param([Parameter(Mandatory)]$param1, $param2, ...) # setting a parameter as necessary