Maystyle :
Admin : New post
Guestbook
Local
media
Catergories
Recent Articles
Recent Comments
Recent Trackbacks
Calendar
Tag
Archive
Link
Search
 
  Quick Tip by minkim [Power Shell] 
작성일시 : 2011. 4. 1. 17:56 | 분류 : Quick Tips

Q : How can I using the system environment variables on the power shell prompt?
Q : 파워셀에서 시스템 환경 변수를 쓰고 싶어요 어떻게 해야할까요?

A : Normally on the cmd prompt we use a system environment variable like this %”EnvVariableName”% but on the Power shell prompt it doesn’t work. So $Env:”EnvVariableName” is right usage on the power shell prompt.
A : 일반적으로 우리는 CMD 상에서 %”환경변수명”%를 이용합니다. 하지만 이는 파워쉘에서는 동작하지 않습니다. 파워쉘에서는 $Env”환경변수명” 으로 사용하시면 됩니다.

Check System Environment variables.
CMD > Set
Usage : %EnvVariableName%
PowerShell > set-location env:\ > get-item *
Usage : $Env:EnvVariableName

Example
Netdom renamecomputer %computername% /newname:W2K8OV-DC
Netdom renamecomputer $Env:computername /newname:W2K8OV-DC

|