Misc. Flashcards
& ‘.\some.exe’ /switch | Out-Null
Piping to Out-Null will cause the script to wait until the exe has terminated.
How should you run an .exe in a .ps1 script?
& ‘.\some.exe’ /switches
What is the file ext. for a Powershell script?
.ps1
Get the version of Powershell
$host.version
comment multiple lines
>
<#
…
Get the computer name
$name = Get-Content env:computerName
Change the background color to green
-backGroundColor = green
change the font color to black
-foreGroundColor = black
what colors work with -backGroundColor and -foreGroundColor
Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow DarkGray Gray Blue Green Cyan Red Magenta Yellow White
Call a .bat file from within a .ps1
.\batchfile.bat
Count and display no. of dirs
$dirs = (get-childItem “c:\path” -name).count
&
invocation operator.