|
Top > PowerShell 基本
|
| Unix | PowerShell |
|---|---|
| ls | ls |
| Get-ChildItem | |
| cat | cat |
| Get-Content | |
| grep | Select-String |
| sort | sort |
| uniq | Get-Unique |
| find | ls -recurse |
| ps | ps |
| Get-Process | |
| stat | Get-Item |
| リダイレクト(>) | Set-Content |
| alias | alias |
| Get-Alias" | |
| wget | (New-Object System.Net.WebClient).DownloadFile($url, $saveFullPath) |
| tee | Tee-Object |
| echo | echo |
new-object -com
PS C:\Documents and Settings\ao> $ie Application : System.__ComObject Parent : System.__ComObject Container : Document : mshtml.HTMLDocumentClass TopLevelContainer : True Type : HTML ドキュメント Left : 0 Top : 84 Width : 913 Height : 650 LocationName : Google LocationURL : http://www.google.co.jp/ Busy : False Name : Microsoft Internet Explorer HWND : 622526774 FullName : C:\Program Files\Internet Explorer\iexplore.exe Path : C:\Program Files\Internet Explorer\ Visible : True StatusBar : True StatusText :
#pre{{
foreach ($l in cat get.sh) { if ($l.IndexOf("grep") -ge 0) {write $l.Replace("grep", "Select-String");} else { write $l;}}
}}
。-match, -notmatch, -cmatch(大文字小文字を区別する)でマッチするかどうかTrue/Falseを返す
"Microsoft" -match "Sof" => True "Microsoft" -cmatch "Sof" => False
普通に
New-Object RegEx "soft"
も使える。
テストの実行: Windows PowerShell を使用した Web UI テストの自動化
http://msdn.microsoft.com/ja-jp/magazine/cc337896.aspx
InternetExplorerオブジェクトのリファレンス
http://msdn.microsoft.com/en-us/library/aa752084(VS.85).aspx
$ie = New-Object -com InternetExplorer.Application
$ie.Visible = $True
$ie.Navigate("http://www.google.co.jp")
$ie.Document.body.innerHTML // HTML表示
$ie.Document.f.q.value = "検索語"
$ie.Document.f.submit()
$ie.Quit()