####################### # getting help ####################### # where are we? get-location # windows style pwd # PS being somewhat compatible with UNIX # getting help for a command get-help pwd man pwd # manual pages ####################### # simple math ####################### 2*3 2/3 15+15 * 2/3 # how do we get two thirds of 15 plus 15? (15+15) * (2/3) ####################### # keyboard shortcuts ####################### # autocomplete and cancel get- control-C # don't worry if these are not very understandable yet ####################### # running programs ####################### notepad chrome # where is it? right-click shortcut cd 'C:\Program Files (x86)\Google\Chrome\Application' chrome.exe get-command notepad get-command .\chrome # mention PATH environment variables (minimal details) ####################### # home directory ####################### # talk about home directory cd ~ pwd cd Desktop ls ####################### # hidden files/extensions ####################### # why don't the file names all look the same? # talk about hidden files and extensions ####################### # new directory ####################### cd ~/examples # does not exist, so create it mkdir ~/examples cd ~\examples # we can get back to this by hitting the up arrow pwd ####################### # different paths for the same file ####################### # observe that the same folder has the same name cd ~/examples # powershell accepts slashes in either direction pwd cd L:\examples # absolute path pwd cd ../examples # relative path pwd ####################### # command arguments ####################### # talk about arguments cd .. ls get-help ls # dash (argument), square brackets (optional), angle brackets (replace with something) ls -Path examples ls examples ####################### # reading and writing files ####################### echo howdy echo howdy > file.txt ls cat file.txt notepad file.txt # and edit something cat file.txt echo line2 > file.txt cat file.txt # what happened to the first line? echo line1 > file.txt echo line2 >> file.txt echo line3 >> file.txt cat file.txt ####################### # moving+copying ####################### cp file.txt file-copy.txt ls cat file-copy.txt mv file-copy file-v2.txt ls rm file-v2.txt ####################### # advanced file listing ####################### echo hey > other.log echo hey > other2.log ls *.txt ls *.log mkdir sub1 mkdir sub2 ls echo hey > sub1/f1.txt echo hey > sub1/f2.txt echo hey > sub1/f3.txt echo hey > sub2/somefile echo hey > sub2/f1.txt ls ls -r tree clear ####################### # input ####################### # arguments echo this is a test echo "this is a test" # stdin read-host this is a test # discuss difference between arguments and stdin ####################### # pipe ####################### # sometimes we want to use the output of one program as input to # another ls | measure ls -r | measure rm file.txt ls -r | measure echo "this is a test" | measure -Word echo "this is a test" | measure -Character # in bash, we use "wc" ####################### # scripts ####################### echo "ls" > test.ps1 test.ps1 notepad test.ps1 # add something cat test.ps1 test.ps1 ####################### # python ####################### start python arithmetic in interactive mode exit run some scripts (if time)