summaryrefslogtreecommitdiffhomepage
path: root/powershell.html.markdown
diff options
context:
space:
mode:
authorAndrew Ryan Davis <AndrewDavis1191@gmail.com>2020-08-19 23:23:53 -0700
committerAndrew Ryan Davis <AndrewDavis1191@gmail.com>2020-08-20 12:30:32 -0700
commitc0a8574825e24a924a693c8b74941a65f25683ec (patch)
treeb441a0f60f35cc380e16bcaff8a58c1875d6738d /powershell.html.markdown
parentea49b693cca150335ee20df5b97b1f5aaec3634c (diff)
Fixing typo and some other formatting
Doubled input on 'pipeline' spaces between commented sections expand alias on where
Diffstat (limited to 'powershell.html.markdown')
-rw-r--r--powershell.html.markdown14
1 files changed, 5 insertions, 9 deletions
diff --git a/powershell.html.markdown b/powershell.html.markdown
index 6a850028..da4dcd5c 100644
--- a/powershell.html.markdown
+++ b/powershell.html.markdown
@@ -29,6 +29,7 @@ Powershell as a Language:
like so
#>
+
####################################################
## 1. Primitive Datatypes and Operators
####################################################
@@ -191,6 +192,7 @@ $someVariable # => 5
# Ternary Operators exist in Powershell 7 and up
0 ? 'yes' : 'no' # => no
+
# The default array object in Powershell is an fixed length array
$defaultArray = "thing","thing2","thing3"
# you can add objects with '+=', but cannot remove objects
@@ -282,8 +284,6 @@ $filledHash["one"] # => 1
# items maintain the order at which they are inserted into the dictionary.
$filledHash.keys # => ["one", "two", "three"]
-
-
# Get all values as an iterable with ".Values".
$filledHash.values # => [1, 2, 3]
@@ -303,7 +303,6 @@ $filledHash["four"] = 4 # $filledHash["four"] is set to 4, run again and it does
$filledHash.Remove("one") # Removes the key "one" from filled dict
-
####################################################
## 3. Control Flow and Iterables
####################################################
@@ -403,7 +402,6 @@ $contents | Out-File "$env:HOMEDRIVE\file.txt" # writes to another file
Get-Content "$env:HOMEDRIVE\file.csv" | ConvertTo-Json
-
####################################################
## 4. Functions
####################################################
@@ -484,7 +482,6 @@ Get-Command -module dbaTools
Get-Help dbaTools -Full
-
####################################################
## 6. Classes
####################################################
@@ -538,7 +535,6 @@ True False Guitar Instrument
#>
-
####################################################
## 7. Advanced
####################################################
@@ -558,13 +554,13 @@ Get-Process | Foreach-Object ProcessName | Group-Object
# Useful pipeline examples are iteration and filtering
1..10 | ForEach-Object { "Loop number $PSITEM" }
-1..10 | where {$PSITEM -gt 5} | Format-Table
+1..10 | Where-Object { $PSITEM -gt 5 } | ConvertTo-Json
# A noteable pitfall of the pipeline is it's performance when
# compared with other options
-# additionally, raw bytes are not passed through the piipeline
+# Additionally, raw bytes are not passed through the pipeline
# so passing an image causes some issues
-# See more on that in the links at the bottom
+# See more on that in the link at the bottom
<#
Asynchronous functions exist in the form of jobs