파워셸 위치
-
Windows Server 2008에서
PowerShell.exe
의 위치를 찾기 위해Host.version
사용 -
Windows Server 2008에서
PowerShell.exe
의 위치를 찾기 위해Get-Process
사용

PowerShell은 스크립팅 목적, 자동화 요구사항 및 CI/CD 시스템 관리를 위한 명령 줄 인터페이스로, Windows 7부터 시작하여 모든 Windows PC에 기본적으로 설치됩니다.
Windows 사용자와 Linux와 유사한 시스템 사용자의 간극을 메우는 데 사용됩니다.
이 기사에서는 PowerShell.exe
파일 위치를 찾는 다양한 방법에 대해 주로 다룹니다.
제공된 솔루션의 주요 사용자 그룹은 Windows Server 2008 사용자입니다. 그러나 Windows 7 버전 이상의 사용자에게도 적용됩니다.
Windows Server 2008에서 PowerShell.exe
의 위치를 찾기 위해 Host.version
사용
버전 1.0보다 최신 버전의 Windows PowerShell을 사용하면 Windows PowerShell에 대한 올바른 경로를 찾는 데 어려움이 있을 수 있습니다. 제 경우에는 Windows 10 PC에 PowerShell 버전 5가 설치되어 있습니다.
하지만 Windows PowerShell에서 디렉토리를 여는 명령인 dir
을 실행하면 표시되는 버전은 v1.0입니다.
PS C:\Windows\System32\WindowsPowerShell> dir
출력:
Directory: C:\Windows\System32\WindowsPowerShell
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 4/9/2021 7:23 PM v1.0
여기서 발생하는 것은 Microsoft에 의해 디렉토리 이름으로 인한 혼동입니다.
Length Name이 v1.0으로 표시되지만, 이것은 제 PC에서 PowerShell 응용 프로그램의 실제 버전 이름이 아닙니다. 따라서 우리는 $Host.version
명령을 사용하여 PowerShell의 올바른 버전을 찾을 것입니다.
PS C:\Windows\System32\WindowsPowerShell> $Host.version
이 코드의 출력은 PowerShell의 올바른 주요 및 부 버전을 보여줍니다.
PS C:\Windows\System32\WindowsPowerShell> $Host.version
Major Minor Build Revision
---- - ---- - ---- - --------
5 1 19041 1320
보시다시피, 버전은 Windows PowerShell 5.1이며, v1.0 버전이 아닙니다.
이 혼동은 개발자가 버전을 업데이트하는 동안 발생합니다. 그러나 파일 폴더 이름은 여전히 v1.0으로 남아 있습니다. v1.0 폴더 디렉토리 안에는 Windows PowerShell 5.1의 .exe
파일이 있습니다.
올바른 위치를 찾으면 v1.0 폴더 안으로 들어가서 .exe
파일을 가져와야 합니다. 올바른 버전 정보를 찾으려면 PowerShell의 $Host.version
명령을 실행해야 합니다.
Windows Server 2008에서 PowerShell.exe
의 위치를 찾기 위해 Get-Process
사용
Windows PC에서 PowerShell.exe
파일의 위치 경로를 찾는 편리한 방법은 Get-Process
명령을 통해 가능합니다.
명령을 실행하기 위해 PowerShell 폴더로 직접 이동할 필요가 없습니다. 아래는 PowerShell.exe
파일의 경로를 직접 보여줄 명령입니다.
PS C:\Users\Agni> (Get-Process powershell | select -First 1).Path
출력:
PS C:\Users\Agni> (Get-Process powershell | select -First 1).Path
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
따라서 이 방법은 필요한 .exe
파일에 대한 올바른 경로를 결정하는 수고 없는 방법으로 식별될 수 있습니다. 그러나 이전 방법에서와 같이 PowerShell의 버전을 식별할 수는 없습니다.
Nimesha is a Full-stack Software Engineer for more than five years, he loves technology, as technology has the power to solve our many problems within just a minute. He have been contributing to various projects over the last 5+ years and working with almost all the so-called 03 tiers(DB, M-Tier, and Client). Recently, he has started working with DevOps technologies such as Azure administration, Kubernetes, Terraform automation, and Bash scripting as well.