video stop at 1h
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# This is a command
|
||||
|
||||
Write-Host "hello world" -NoNewline
|
||||
Write-Host "hello world"
|
||||
|
||||
$FavSystem = Read-Host -Prompt "What is your favorite Nintendo system"
|
||||
|
||||
9
2.Read_Host.ps1
Normal file
9
2.Read_Host.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
Write-Host "What is your favorite system ?"
|
||||
Write-Host "1. NES"
|
||||
Write-Host "2. SNES"
|
||||
Write-Host "3. N64"
|
||||
Write-Host "4. Gamecube"
|
||||
Write-Host "5. Wii"
|
||||
Write-Host "6. Wii U"
|
||||
Write-Host "7. Switch"
|
||||
$FavSystem = Read-Host -Prompt "Select One [1 . 6]"
|
||||
7
3.Evaluate.ps1
Normal file
7
3.Evaluate.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
$PokemonCaught = "908"
|
||||
|
||||
If($PokemonCaught -eg 908) {
|
||||
Write-Host "You're a Pokemon Master! "
|
||||
} Else {
|
||||
Write-Host "Go catch more Pokemon!"
|
||||
}
|
||||
10
4.IfElse.ps1
Normal file
10
4.IfElse.ps1
Normal file
@@ -0,0 +1,10 @@
|
||||
$PokemeonNum = 25
|
||||
|
||||
If($PokemeonNum -ge 1 -and $PokemeonNum -le 151){
|
||||
Write-Host "Your Pokemon is from Kanto!"
|
||||
} Elseif($PokemeonNum -ge 152 -and $PokemeonNum -le 251){
|
||||
Write-Host "Your Pokemon is from Johto!"
|
||||
}Elseif($PokemeonNum -ge 252 -and $PokemeonNum -le 386){
|
||||
Write-Host "Your Pokemon is from Hoenn!"
|
||||
|
||||
}
|
||||
7
5.Switch.ps1
Normal file
7
5.Switch.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
$House = "Targaryen"
|
||||
|
||||
Switch($House){
|
||||
"Targaryen" {Write-Host "You're crazy!"; break}
|
||||
"Lannister" {Write-Host "You always pay your debts!"; break}
|
||||
"Stark" {Write-Host "Nothing bad is going to happen at the wall"; break}
|
||||
}
|
||||
6
6.for_loops.ps1
Normal file
6
6.for_loops.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
$HaloPeeps = @('Master Chief', 'Cortana', 'Captain Keys', 'Flood')
|
||||
|
||||
For($counter = 0; $counter -le 3; $counter++){
|
||||
Write-Host "Holy smokes. it's" $HaloPeeps[$counter]
|
||||
|
||||
}
|
||||
@@ -64,6 +64,7 @@ Command-1 | Command-2
|
||||
"May the force be with you!" | Out-File forewithwho.txt
|
||||
```
|
||||
|
||||
|
||||
## Variables
|
||||
|
||||
They start with a "$"
|
||||
@@ -81,4 +82,61 @@ $x + $y
|
||||
|
||||
$FavCharacter | Select-Object -Property *
|
||||
# output all the Property of the variable
|
||||
Get-Member -InputObject $FaveCharacter
|
||||
# output all the mehtods you can use
|
||||
```
|
||||
|
||||
## Arrays
|
||||
|
||||
A collection of variables
|
||||
|
||||
```powershell
|
||||
$Jedi = @('Obi-Wan Kenobi', 'Luke Skywalker', 'Master Yoda', 'Mace Windu')
|
||||
|
||||
$Jedi.GetType()
|
||||
# output Object[]
|
||||
|
||||
$Jedi[0]
|
||||
# output : Obi-Wan Kenobi
|
||||
|
||||
$Jedi[0].Length
|
||||
# output 14
|
||||
|
||||
$Jedi += 'Qui-Gon Jin'
|
||||
# add a variable to the array
|
||||
```
|
||||
|
||||
## hash table
|
||||
|
||||
Specify keys
|
||||
|
||||
```powershell
|
||||
$FellowshipBeta = @{key1 = "item1"; key2 = "item2"}
|
||||
|
||||
$Fellowship = @{"Wizard" = "Gandalf"; "Elf" = "Legolas"; "Hobbit" = "Frodo"}
|
||||
|
||||
$Fellowship.Add("Dwarf", "Gimli")
|
||||
# for adding an element
|
||||
|
||||
$Fellowship.Set_Item("Dwarf", "Bilbo")
|
||||
# changing an element
|
||||
|
||||
$Fellowship."Dwarf"
|
||||
$Fellowship.["Dwarf"]
|
||||
# retrieve an element
|
||||
|
||||
$Fellowship.Remove("Dwarf")
|
||||
# Remove an element
|
||||
```
|
||||
|
||||
## Read-Host
|
||||
for having user iput
|
||||
|
||||
## Evaluatig
|
||||
|
||||
```powershell
|
||||
|
||||
$PokemonCaught = "908"
|
||||
If($PokemonCaught -eg 908) { Write-Host "You're a Pokemon Master! "}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user