2021-06-01
よくつかうエイリアス
Clear-Host | clear, cls |
Compare-Object | compare, diff |
Copy-Item | copy, cp, cpi |
ForEach-Object | %, foreach |
Get-ChildItem | dir, gci, ls |
Get-Content | cat, gc, type |
Get-History | ghy, h, history |
Get-Location | gl, pwd |
Get-Process | gps, ps |
help | man |
Invoke-WebRequest | curl, iwr, wget |
mkdir | md |
Move-Item | mi, move, mv |
New-Item | ni |
New-PSDrive | mount, ndr |
Remove-Item | del, erase, rd, ri, rm, rmdir |
Rename-Item | ren, rni |
Select-Object | select |
Set-Location | cd, chdir, sl |
Set-Variable | set, sv |
Start-Process | saps, start |
Stop-Process | kill, spps |
Where-Object | ?, where |
Write-Output | echo, write |
このコマンドの代わりは?
which | Get-Command |
time | measure-command |
grep | select-string |
touch a.txt ( b.txt c.txt) | new-item a.txt (, b.txt, c.txt) |
| |
変数への代入
$greet="hello"
$files=Get-ChildItem
オブジェクトのプロパティの確認
$files | get-member
TypeName: System.IO.FileInfo
Name MemberType Definition
---- ---------- ----------
LinkType CodeProperty System.String LinkType{get=GetLinkType;}
...
比較演算子
about_Comparison_Operators
-eq | == |
-ne | != |
-gt | > |
-ge | >= |
-lt | < |
-le | <= |
-like | 文字列がワイルドカードパターンと一致 |
-notlike | 同 一致しない |
-match | 文字列が正規表現パターンと一致 |
-notmatch | 同 一致しない |
絞り込み
$files |? {$_.name -like "*src*"}
ディスカッション
コメント一覧
まだ、コメントがありません