about_History

업데이트 날짜: 2014년 5월

적용 대상: Windows PowerShell 2.0, Windows PowerShell 3.0, Windows PowerShell 4.0, Windows PowerShell 5.0

항목

about_History

간단한 설명

명령 기록의 명령을 가져오고 실행하는 방법에 대해 설명합니다.

자세한 설명

명령 프롬프트에서 명령을 입력하면 Windows PowerShell®은 명령을 명령 기록에 저장합니다. 기록의 명령을 작업 기록으로 사용할 수 있습니다. 또한 명령 기록에서 명령을 호출하여 실행할 수 있습니다.

기록 cmdlet

Windows PowerShell은 명령 기록을 관리하는 cmdlet 집합을 포함하고 있습니다.

          Cmdlet (Alias)       Description
          -------------------  ------------------------------------------
          Get-History (h)      Gets the command history.

          Invoke-History (r)   Runs a command in the command history.

          Add-History          Adds a command to the command history.

          Clear-History (clh)  Deletes commands from the command history.

기록을 관리하기 위한 바로 가기 키

Windows PowerShell 콘솔에서 다음과 같은 바로 가기를 사용하여 명령 기록을 관리할 수 있습니다.

다른 호스트 응용 프로그램에 대해서는 해당 제품 설명서를 참조하세요.

          Use this key      To perform this action
          -------------     ----------------------------------------------
          UP ARROW          Displays the previous command.
 
          DOWN ARROW        Displays the next command.
 
          F7                Displays the command history. 
                            To hide the history, press ESC.
 
          F8                Finds a command. Type one or more characters,
                            and then press F8. For the next instance, 
                            press F8 again.

          F9                Find a command by history ID. Type the history
                            ID, and then press F9. To find the ID, press F7.

MAXIMUMHISTORYCOUNT

$MaximumHistoryCount 기본 설정 변수는 Windows PowerShell가 명령 기록에 저장하는 최대 명령 수를 결정합니다. 기본값은 4096이며, 이는 Windows PowerShell가 최근 명령 4096개를 저장한다는 것을 의미하지만, 변수의 값을 변경할 수 없습니다.

예를 들어 다음 명령은 $MaximumHistoryCount를 명령 100개로 낮춥니다.

          $MaximumHistoryCount = 100

설정을 적용하려면 Windows PowerShell를 다시 시작합니다.

모든 Windows PowerShell 세션에 대한 새 변수 값을 저장하려면 Windows PowerShell 프로필에 대입문을 추가합니다. 프로필에 대한 자세한 내용은 about_Profiles(https://go.microsoft.com/fwlink/?LinkID=113729)를 참조하세요.

$MaximumHistoryCount 기본 설정 변수에 대한 자세한 내용은 about_Preference_Variables(https://go.microsoft.com/fwlink/?LinkID=113248)를 참조하세요.

참고:

Windows PowerShell 2.0에서 $MaximumHistoryCount 기본 설정 변수의 기본값은 64입니다.

기록의 명령 순서

명령은 명령을 입력할 때가 아니라 명령이 실행을 마칠 때 기록에 추가됩니다. 명령을 완료하는 데 꽤 시간이 걸리거나 명령을 중첩 프롬프트에서 실행 중인 경우 명령이 기록에서 순서가 흐트러진 상태로 나타날 수 있습니다. (중첩 프롬프트에서 실행 중인 명령은 프롬프트 수준을 종료할 때에만 완료됩니다.)

참고 항목

about_Line_Editing

about_Preference_Variables

about_Profiles

about_Variables