このブログを検索

2023年3月24日金曜日

power shell コマンド一覧

Grep検索

Get-ChildItem -Recurse | Select-String -Pattern "単語" -SimpleMatch

下の階層に移動

cd .\サブディレクトリ名\

ひとつ上の階層に移動

cd ..

現在のディレクトリのファイル、フォルダ一覧を表示

Get-ChildItem

Get-ChildItemコマンドレットには、-Recurseオプションを使用することで、現在のディレクトリ以下のすべてのファイルとフォルダを再帰的に表示

Get-ChildItem -Recurse

C:\test

    ├─ folder1

    │   ├─ file1.txt

    │   └─ file2.txt

    └─ folder2

        ├─ file3.txt

        └─ folder3

            └─ file4.txt

絶対パスで移動

cd "C:\work"

Grep検索 ファイル名 パス 行数 表示

Get-ChildItem -Recurse | Select-String -Pattern "テスト" | Select-Object @{n='Path';e={$_.Path}}, LineNumber | Format-Table -AutoSize

処理中止

Ctrl+C

注目の投稿

じぇらいす まちおこし

人気の投稿