SlideShare a Scribd company logo
Jason
Array
   > $a = 1, 2, 3, 4, 5

   String.Object[]

   > $b = 1, “C”, 2.99, (Get-Process)

   可用 @() ,表示新增 Array
Array
   > $a = 2, 3, 4

   > $a[0, 2]

   > $a[0, -1]

   > $a[1] = 10, 20, 30

   > $a = $a + 1
Array
   > 1, 2, 3, 4 –contains 4

   > 1, 2, 3,4 –notcontains 3

   > 1, 2, 3 –contains “3”

   > 1, 2, “03” –contains 3
ForEach-Object
簡寫為 foreach

> 1,2,3 | ForEach-Object { $_ * 2 }
或
> 1,2,3 | foreach { $_ * 2 }
Select-Object
簡寫為 select

> Get-Process chrome | Select-Object ProcessName,Id
Sort-Object
簡寫為 sort

Get-Process chrome | Sort-Object Id

Get-Process chrome | Sort-Object Id -Descending
Tee-Object
簡寫為 tee
>3,2,1 | Tee-Object -Variable unsorted | Sort-Object
1
2
3

>$unsorted
3
2
1
Group-Object
簡寫為 group

> dir | Group-Object -Property Extension

Count Name                 Group
----- ----                -----
   1 .android          {.android}
   1 .10               {.gstreamer-0.10}
  16                   {Contacts, Desktop, Documents, Downloads...}
   1 .kdiff3rc         {.kdiff3rc}
   1 .userId           {.org.eclipse.epp.usagedata.recording.userId}
   1 .txt              {a.txt}
   1 .ini              {mercurial.ini}
Measure-Object

>1,2,3,4 | Measure-Object -Sum -Max -Min -Average

Count : 4
Average : 2.5
Sum    : 10
Maximum : 4
Minimum : 1
Compare-Object
簡寫為 diff
>$a = @(1,2,4)
>$b = @(1,3,4)
>Compare-Object -ReferenceObject $a -DifferenceObject $b
>Compare-Object $a $b

InputObject SideIndicator
    ----------- -------------
             3 =>
             2 <=
Read Word File
ProgID : Word.Application

$wordApp = New-Object -COM Word.Application
$file = (dir Test.docx).FullName
$doc = $wordApp.Documents.Open($file)
$text = $doc.Content.Text
$text

$wordApp.Exit
Create Word File
$path = Join-Path (Get-Location) create.doc
$wordApp = New-Object -COM Word.Application
#$wordApp.Visible = $true
if (Test-Path $path)
{
    del $path
}

$doc = $wordApp.Documents.Add()
$doc.Content.Text = "This is a book!!"
$doc.SaveAs($path)

$wordApp.Quit()
Edit Word File
$wordApp = New-Object -COM Word.Application
$file = (dir Test.docx).FullName
$doc = $wordApp.Documents.Open($file)
$documentFront = $doc.Content
$documentFront.End = $start.Start

$documentFront.Text ="Sorry"
$documentFront.Font.Name="Times new roman"
$documentFront.Font.ColorIndex = 6

$doc.save()
$wordApp.Quit()
Reference
http://technet.microsoft.com/zh-TW/library/dd315334.aspx

http://www.books.com.tw/exep/prod/booksfile.php?item=00104


 http://powershell.com/cs/blogs/ebook/default.aspx

More Related Content

PDF
Python dictionary : past, present, future
delimitry
 
PDF
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Mohammad Reza Kamalifard
 
PDF
Functional es6
Natalia Zaslavskaya
 
PDF
MongoDB
Hemant Kumar Tiwary
 
PDF
Python Workshop Part 2. LUG Maniapl
Ankur Shrivastava
 
PDF
PromptWorks Talk Tuesdays: Ray Zane 1/17/17 "Elixir Is Cool"
PromptWorks
 
PPTX
Python Lecture 10
Inzamam Baig
 
PPTX
Python Lecture 11
Inzamam Baig
 
Python dictionary : past, present, future
delimitry
 
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Mohammad Reza Kamalifard
 
Functional es6
Natalia Zaslavskaya
 
Python Workshop Part 2. LUG Maniapl
Ankur Shrivastava
 
PromptWorks Talk Tuesdays: Ray Zane 1/17/17 "Elixir Is Cool"
PromptWorks
 
Python Lecture 10
Inzamam Baig
 
Python Lecture 11
Inzamam Baig
 

What's hot (19)

PDF
Patterns in Terraform 12+13: Data, Transformations and Resources
Katie Reese
 
PDF
Python programming : List and tuples
Emertxe Information Technologies Pvt Ltd
 
PPTX
Python chapter 2
Raghu nath
 
PPTX
python chapter 1
Raghu nath
 
PDF
Day 1c access, select ordering copy.pptx
Adrien Melquiond
 
PPTX
Python programming -Tuple and Set Data type
Megha V
 
PDF
List , tuples, dictionaries and regular expressions in python
channa basava
 
ODP
Grails: a quick tutorial (1)
Davide Rossi
 
PDF
Inheritance & polymorphism java oop
hussein zayed
 
PDF
Python Variable Types, List, Tuple, Dictionary
Soba Arjun
 
PDF
Using Scala Slick at FortyTwo
Eishay Smith
 
PDF
7 Habits For a More Functional Swift
Jason Larsen
 
ODP
Patterns for slick database applications
Skills Matter
 
PDF
Java script objects 1
H K
 
PDF
Elixir pattern matching and recursion
Bob Firestone
 
KEY
CoffeeScript - A Rubyist's Love Affair
Mark
 
PDF
Database API, your new friend
kikoalonsob
 
Patterns in Terraform 12+13: Data, Transformations and Resources
Katie Reese
 
Python programming : List and tuples
Emertxe Information Technologies Pvt Ltd
 
Python chapter 2
Raghu nath
 
python chapter 1
Raghu nath
 
Day 1c access, select ordering copy.pptx
Adrien Melquiond
 
Python programming -Tuple and Set Data type
Megha V
 
List , tuples, dictionaries and regular expressions in python
channa basava
 
Grails: a quick tutorial (1)
Davide Rossi
 
Inheritance & polymorphism java oop
hussein zayed
 
Python Variable Types, List, Tuple, Dictionary
Soba Arjun
 
Using Scala Slick at FortyTwo
Eishay Smith
 
7 Habits For a More Functional Swift
Jason Larsen
 
Patterns for slick database applications
Skills Matter
 
Java script objects 1
H K
 
Elixir pattern matching and recursion
Bob Firestone
 
CoffeeScript - A Rubyist's Love Affair
Mark
 
Database API, your new friend
kikoalonsob
 
Ad

More from LearningTech (20)

PPTX
vim
LearningTech
 
PPTX
PostCss
LearningTech
 
PPTX
ReactJs
LearningTech
 
PPTX
Docker
LearningTech
 
PPTX
Semantic ui
LearningTech
 
PPTX
node.js errors
LearningTech
 
PPTX
Process control nodejs
LearningTech
 
PPTX
Expression tree
LearningTech
 
PPTX
SQL 效能調校
LearningTech
 
PPTX
flexbox report
LearningTech
 
PPTX
Vic weekly learning_20160504
LearningTech
 
PPTX
Reflection &amp; activator
LearningTech
 
PPTX
Peggy markdown
LearningTech
 
PPTX
Node child process
LearningTech
 
PPTX
20160415ken.lee
LearningTech
 
PPTX
Peggy elasticsearch應用
LearningTech
 
PPTX
Expression tree
LearningTech
 
PPTX
Vic weekly learning_20160325
LearningTech
 
PPTX
D3js learning tips
LearningTech
 
PPTX
git command
LearningTech
 
PostCss
LearningTech
 
ReactJs
LearningTech
 
Docker
LearningTech
 
Semantic ui
LearningTech
 
node.js errors
LearningTech
 
Process control nodejs
LearningTech
 
Expression tree
LearningTech
 
SQL 效能調校
LearningTech
 
flexbox report
LearningTech
 
Vic weekly learning_20160504
LearningTech
 
Reflection &amp; activator
LearningTech
 
Peggy markdown
LearningTech
 
Node child process
LearningTech
 
20160415ken.lee
LearningTech
 
Peggy elasticsearch應用
LearningTech
 
Expression tree
LearningTech
 
Vic weekly learning_20160325
LearningTech
 
D3js learning tips
LearningTech
 
git command
LearningTech
 
Ad

Recently uploaded (20)

PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Software Development Methodologies in 2025
KodekX
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
The Future of Artificial Intelligence (AI)
Mukul
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Software Development Methodologies in 2025
KodekX
 

Power shell object