주제
Format-Table 사용하기
열이 너무 좁아 데이터를 모두 표시할 수 없는 경우 ... 로 표시되는데
이때 모두 보고 싶을때 유용하게 사용 가능하다.
방법
다른명령과 같이 사용한다.
옵션
-AutoSize
열이 너무 좁아 데이터를 모두 표시할 수 없는 경우
-Wrap
단독으로 사용하면 프로세스 속도가 크게 느려지지 않음
-GroupBy
: 속성 값을 기준으로 출력을 그룹화할 수 있음
실행
Get-Service -Name ora*
PS D:\> Get-Service -Name win*
Status Name DisplayName
------ ---- -----------
Running WinDefend Microsoft Defender Antivirus Service
Running WinHttpAutoProx... WinHTTP Web Proxy Auto-Discovery Se...
Running Winmgmt Windows Management Instrumentation
Stopped WinRM Windows Remote Management (WS-Manag...
Get-Service -Name ora* | Format-Table -AutoSize
PS D:\> Get-Service -Name ora* | Format-Table -AutoSize
Status Name DisplayName
------ ---- -----------
Stopped OracleJobSchedulerXE OracleJobSchedulerXE
Stopped OracleMTSRecoveryService OracleMTSRecoveryService
Stopped OracleServiceXE OracleServiceXE
Stopped OracleXEClrAgent OracleXEClrAgent
Running OracleXETNSListener OracleXETNSListener
Get-Service -Name ora* | Format-Table -Wrap
PS D:\> Get-Service -Name ora* | Format-Table -Wrap
Status Name DisplayName
------ ---- -----------
Stopped OracleJobScheduler OracleJobSchedulerXE
XE
Stopped OracleMTSRecoveryS OracleMTSRecoveryService
ervice
Stopped OracleServiceXE OracleServiceXE
Stopped OracleXEClrAgent OracleXEClrAgent
Running OracleXETNSListene OracleXETNSListener
r
Get-Service -Name win* | Sort-Object StartType | Format-Table -GroupBy StartType
PS D:\> Get-Service -Name win* | Sort-Object StartType | Format-Table -GroupBy StartType
StartType: Automatic
Status Name DisplayName
------ ---- -----------
Running Winmgmt Windows Management Instrumentation
Running WinDefend Microsoft Defender Antivirus Service
StartType: Manual
Status Name DisplayName
------ ---- -----------
Stopped WinRM Windows Remote Management (WS-Manag...
Running WinHttpAutoProx... WinHTTP Web Proxy Auto-Discovery Se...
PS D:\>
출처
Format-Table을 사용하여 표 형식으로 출력
https://docs.microsoft.com/ko-kr/powershell/scripting/samples/using-format-commands-to-change-output-view?view=powershell-7.2
728x90