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

잔글 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
4번째 줄: 4번째 줄:


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


==방법 2: $PSVersionTable==
==방법 2: $PSVersionTable==
<source lang='cli'>
<source lang='console'>
PS C:\Users\jmnote> $PSVersionTable | findstr ^PSVersion
PS C:\Users\jmnote> $PSVersionTable | findstr ^PSVersion
PSVersion                      2.0
PSVersion                      2.0
</source>
</source>
<source lang='cli'>
<source lang='console'>
PS C:\Users\jmnote> ($PSVersionTable|findstr PSVersion).substring(31)
PS C:\Users\jmnote> ($PSVersionTable|findstr PSVersion).substring(31)
2.0
2.0
</source>
</source>
<source lang='cli'>
<source lang='console'>
PS C:\Users\jmnote> $PSVersionTable.PSVersion
PS C:\Users\jmnote> $PSVersionTable.PSVersion


33번째 줄: 33번째 줄:


==방법 3: $host.version==
==방법 3: $host.version==
<source lang='cli'>
<source lang='console'>
PS C:\Users\jmnote> $host.version
PS C:\Users\jmnote> $host.version


41번째 줄: 41번째 줄:
</source>
</source>
:→ <code>$host.version</code> 대신 <code>(get-host).version</code>을 써도 됨
:→ <code>$host.version</code> 대신 <code>(get-host).version</code>을 써도 됨
<source lang='cli'>
<source lang='console'>
PS C:\Users\jmnote> ""+$host.version.major+"."+$host.version.minor
PS C:\Users\jmnote> ""+$host.version.major+"."+$host.version.minor
2.0
2.0
</source>
</source>
<source lang='cli'>
<source lang='console'>
PS C:\Users\jmnote> $a=$host.version;""+$a.major+"."+$a.minor
PS C:\Users\jmnote> $a=$host.version;""+$a.major+"."+$a.minor
2.0
2.0

2016년 3월 29일 (화) 14:32 판

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

1 방법 1: host

PS C:\Users\jmnote> host | findstr ^Version
Version          : 2.0
→ 2.0
host 대신 $host 또는 get-host를 써도 됨
PS C:\Users\jmnote> (host|findstr Version).substring(19)
2.0

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 }}