2009. 9. 25. 04:31

[WScript.Shell] ExpandEnvironmentStrings - 환경 변수 값 알아내기

-  [Method] ExpandEnvironmentStrings


* 환경변수값 알아내기 *

strReturn = WshShell.ExpandEnvironmentStrings(strString
 
- strReturn : an environment variable's expanded value.
- strString : name of the environment variable.

- Remarks :
    The ExpandEnvironmentStrings method expands environment variables 
    defined in the PROCESS environment space only.


'Visual Basic Script
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")
 

//JScript 
var WshShell = WScript.CreateObject("WScript.Shell");
WScript.Echo("WinDir is " + WshShell.ExpandEnvironmentStrings("%WinDir%"));


출처 : http://ancdesign.pe.kr/60