基本

調べる

  • get-help
    • -detailed
    • -parameter
    • -examples
  • gcm (get-command)
    • -syntax
  • gal (get-alias)
  • gm (get-member)
  • gdr (get-psdrive)
  • h (get-history)
    • (h -Id 5) | iex

フォーマット

  • fl (format-list)
  • ft (format-table)
  • fw (format-wide)
  • fc (format-custom)

ファイル操作など

  • ls
    • ワイルドカード(*?[])
    • -name (短い形式)
    • -force (すべて表示)
    • -exclude
    • -recurse (下に降りれないようなパスの指定は無効 c:\Windows\*.dll)
    • -include (recurseとセットで使う -include *.dll)
  • cp

パイプオブジェクトのフィルタ

  • sort
    • -descending
  • where (or ?)
    • オブジェクトの選択
    • 現在のパイプオブジェクトの自動変数は $_
  • foreach (or %)
    • find(1)の -exec みたいなもの
    • 現在のパイプオブジェクトの自動変数は $_
  • select
    • プロパティの選択 (プロパティは PSCustomObject というコンテナにコピーされる。データを加工できる。)

cmdとの共存

cmd.exeで、cygwin の man コマンド

PS > cmd /c "man nkf"

その他

  • ii (invoke-item ダブルクリックと同じ)