"윈도우 PowerShell 버전 확인"의 두 판 사이의 차이

5번째 줄: 5번째 줄:
==방법 1: host==
==방법 1: host==
<source lang='console'>
<source lang='console'>
PS C:\Users\jmnote> host | findstr ^Version
PS C:\Users\jmnote> host | findstr Version
Version          : 2.0
Version          : 5.1.18362.752
</source>
:→ 2.0
:→ <code>host</code> 대신 <code>$host</code> 또는 <code>get-host</code>를 써도 됨
<source lang='console'>
PS C:\Users\jmnote> (host|findstr Version).substring(19)
2.0
</source>
</source>
:→ 5.1.18362.752


==방법 2: $PSVersionTable==
==방법 2: $PSVersionTable==

2020년 5월 30일 (토) 01:13 판

Check Version of PowerShell
Determine installed PowerShell version
파워쉘 버전 확인

1 방법 1: host

PS C:\Users\jmnote> host | findstr Version
Version          : 5.1.18362.752
→ 5.1.18362.752

2 방법 2: $PSVersionTable

PS C:\Users\jmnote> $PSVersionTable | findstr ^PSVersion
PSVersion                      2.0
PS C:\Users\jmnote> ($PSVersionTable|findstr PSVersion).substring(31)
2.0
PS C:\Users\jmnote> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

3 방법 3: $host.version

PS C:\Users\jmnote> $host.version

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1
$host.version 대신 (get-host).version을 써도 됨
PS C:\Users\jmnote> ""+$host.version.major+"."+$host.version.minor
2.0
PS C:\Users\jmnote> $a=$host.version;""+$a.major+"."+$a.minor
2.0

4 같이 보기

5 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}