Input PowerShell Tutorial - ELTE
[Pages:36]PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
PowerShell Tutorial
Erik Hjelm?s March 22, 2011
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
(OUSTERHOUT, J., "Scripting: Higher-Level Programming for the 21st Century", IEEE Computer, Vol. 31, No. 3, March 1998, pp. 23-30.)
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
WARNING!
The following presentation is NOT meant to be a comprehensive/complete tour of the PowerShell language. The purpose is to get you started with some basic program constructions which you will recognize based on some-sort-of-programming-background. At the end of the presentation (Credits section) you will find pointers to more comprehensive material (reference material).
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
Practice
You need a Windows host running on a physical or virtual machine with working access to the internet, and with PowerShell v2.0 installed. Log in and open a terminal window, download the examples as we go along from
http :// www . hig . no /~ erikh / tutorial-powershell / FILENAME
(or download all at once with filename powershell-examples.zip but remember to unblock before unzip)
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
Hello World
# hello.ps1 Write-Host "hello world!"
execute as long as filename ends with .ps1:
.\ hello . ps1
or direct from command line cmd (DOSPROMPT)
powershell -command "Write-Host \"hello world!\""
or direct from command line powershell
Write-Host "hello world!"
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
Single Variables
# single-var.ps1 $firstname="Mysil" $lastname="Bergsprekken" $fullname="$firstname $lastname" Write-Host "Hello $fullname , may I call you
$firstname ?"
All variables are prefixed with $
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
Single and Double Quotes
# quotes.ps1
$name="Mysil" Write-Host Hello Write-Host "Hello Write-Host Hello
$name $name" $name
PowerShell Tutorial
Erik Hjelm?s
Variables
Arrays Structures/Classes Command-line args
Input
Input System commands
Conditions
if/else Operators Switch/case Where
Iteration
For While Foreach
Math
Functions
RegExp
PowerShell example
PowerShell only
Credits
Arrays
One-dimensional arrays:
# array.ps1
$os=@("linux", "windows")
$os += @(" mac ")
Write-Host $os[1]
# print windows
Write-Host $os
# print entire array
Write-Host $os.Count # length of array
Arrays are created with @(...)
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- windows powershell replace string in filename
- powershell tutorial
- integrating powershell with workspace one vmware
- powershellindepth pdf
- powershell users guide
- s1ql cheatsheet for security analysis sentinelone
- building forms with powershell part 1 the form
- powershell tutorial ntnu
- keeping powershell security measures to use and embrace
- powershell filename from path
Related searches
- windows powershell tutorial pdf
- windows powershell vs powershell x86
- powershell or powershell x86
- powershell tutorial pdf
- powershell script with input parameters
- powershell ise powershell 7
- powershell vs powershell x86
- powershell input parameters
- windows powershell admin vs windows powershell x86
- run powershell from powershell script
- powershell run other powershell script
- powershell script input parameters examples