#author("2024-07-19T07:25:38+09:00","default:nobuoki","nobuoki") #author("2024-07-19T07:26:31+09:00","default:nobuoki","nobuoki") * はじめに [#w80383a3] WSLから呼び出す例 #prism(bash){{{ # powershell 7 pwsh() { '/mnt/c/Program Files/PowerShell/7/pwsh.exe' "$@" } # powershell 5.1など pwsh() { '/mnt/c/Windows/system32/WindowsPowerShell/v1.0/powershell.exe' "$@" } }}} * ps -ef [#oe8d2fe3] コマンド ProcessName順(1行で表示) pwsh -Command 'Get-Process | Select-Object Id, ProcessName, @{Name="CommandLine";Expression={(Get-CimInstance Win32_Process -Filter "ProcessId=$($_.Id)").CommandLine}} | Out-String -Width 4096' Id ProcessName CommandLine -- ----------- ----------- 8596 AdobeCollabSync "C:\Program Files\Adobe\Acrobat DC\Acrobat\AdobeCollabSync.exe" --type=collab-renderer --proc=8956 8956 AdobeCollabSync "C:\Program Files\Adobe\Acrobat DC\Acrobat\AdobeCollabSync.exe" 5308 AggregatorHost 8472 ApplicationFrameHost C:\Windows\system32\ApplicationFrameHost.exe -Embedding 4656 armsvc 13236 bash "C:\cygwin64\bin\bash.exe" --login -c 'pproxy -v -l http+socks4+socks5://0.0.0.0:1080/ -r socks5://nttcs.ecl.ntt.co.jp:1080' 2932 conhost \??\C:\Windows\system32\conhost.exe 0x4 Id順に並べ替え(Out-String -> Format-List に変更しています) Id順に並べ替え(Out-String だと表示が崩れるので Format-List に変更) pwsh -Command 'Get-Process | Sort-Object Id | Select-Object Id, ProcessName, @{Name="CommandLine";Expression={(Get-CimInstance Win32_Process -Filter "ProcessId=$($_.Id)").CommandLine}} | Format-List' Id : 0 ProcessName : Idle CommandLine : Id : 4 ProcessName : System CommandLine : Id : 184 ProcessName : Secure System CommandLine : Id : 300 ProcessName : Registry CommandLine :