- 下載.NET Framework Version 2.0
Microsoft .NET Framework Version 2.0 Redistributable Package (x86)
http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&DisplayLang=en - 安裝.NET Framework Version 2.0
- 下載適合自己作業系統的Windows PowerShell 1.0
http://www.microsoft.com/technet/scriptcenter/topics/msh/download.mspx - 安裝Windows PowerShell 1.0
- Nov 26 Sun 2006 21:41
PowerShell:安裝
- Nov 26 Sun 2006 03:00
PowerShell:ASCII
- 得知A的ASCII code
- [byte][char]"A"
- 65
- 得知ASCII code為65是什麼
- [char]65
- A
- Nov 26 Sun 2006 02:51
PowerShell:Measure-command
欲得知指令的執行時間可使用measure-command
PS C:\Joseph> measure-command{for($i=0;$i -lt 1000000;$i++){$i} }
Days : 0
Hours : 0
Minutes : 0
- Nov 26 Sun 2006 02:36
PowerShell:二進位,八進位以及十六進位
- 欲獲得17的二進位字串
- PS C:\Joseph> [Convert]::ToString(17,2)
- 10001
- 欲獲得17的八進位字串
- PS C:\Joseph> [Convert]::ToString(17,8)
- 21
- 欲獲得17的十六進位字串
- 方法一
- PS C:\Joseph> [Convert]::ToString(17,16)
- 11
- 方法二
- PS C:\Joseph> "{0:X}" -f 17
- 11
- Nov 25 Sat 2006 08:34
PowerShell:Select-String
重點整理自Let's do a deep drill into Select-String by Jeffrey Snover , Windows PowerShell/MMC Architect
- $c="a"
get-alias ($c+"*") #參數有變數 則用()包住 ; 等於get-alias a* - Select-String accepts arrays of wildcards to specify Files
- select-string 欲搜尋字串 欲搜尋之檔案路徑(可為wildcard)
- select-string drive * #搜尋目前路徑下所有檔案中包含*drive*的字串(預設視為前後加*)
- 被搜尋到的對象不能為資料夾???
- select-string drive [a-m]* #搜尋名為a-m開頭的檔案
- select-string drive drive g*,r* #搜尋名為g,r開頭的檔案
- Select-String accepts arrays of regular expressions to specify STRINGS
- 欲搜尋字串可為regular expression
- " [a-r]dr" *
- " [a-r]dr|mount"
- " [a-n]dr"," [m-z]dr"
- 若不想讓搜尋字串被視為regular expression 則要指定 -SimpleMatch
- Select-String accepts –Include and –Exclude to tweak which files it operates on
- 欲搜尋檔案可利用–Include 包含某檔案
- 欲搜尋檔案可利用–Exclude 排除某檔案
- These parameters take a wildcard expression or set of wildcard expressions and operate AFTER the filepath is resolved
- -exclude *[mn]-al* #完整檔案路徑中(不只是檔名)不包含*[mn]-al*
- -exclude [mn]-al* #完整檔案路徑中不包含[mn]-al*
- You can pipe anything that produces FileInfo objects into Select-String
- 欲搜尋之檔案可由pipeline餵近來
- dir [g-r]* |select-string drive
- ([System.IO.DirectoryInfo]"c:\sstest").GetFileSystemInfos() | select-string drive
- You can pipe anything that produces MatchInfo objects into Select-String
- select-string get *|select-string item
- Select-String outputs MatchInfo objects not Strings
- Microsoft.PowerShell.Commands.MatchInfo
- select-string "stop","new.*ve" *|Format-List *
- select-string "stop","new.*ve" *|group Pattern
- Sometimes you just want the first match in a file
- select-string item r* -list
- Nov 23 Thu 2006 05:37
Windows PowerShell in Action - EARLY ACCESS EDITION
- Nov 23 Thu 2006 05:30
[Podcast] PowerShell with Bruce Payette
- Nov 22 Wed 2006 07:55
PowerShell:現在時間
(1)
可以使用get-date指令取得現在時間
執行
PS C:\Joseph> (get-date).ToString("HH:mm:ss")
- Nov 22 Wed 2006 07:32
PowerShell, ping and ipconfig
(1)
執行
PS C:\Joseph> if((ping 140.112.107.132 | Where-Object {$_ -like "*(0% loss)*"}) -eq $null){"The computer is dead"}else{"The computer is alive"}
- Nov 19 Sun 2006 23:46
PowerShell:Invoke-Item
若想要開啟某檔案
可執行
Invoke-Item 完整檔案路徑
系統將使用預設關聯的應用程式開啟該檔案