此silverlight代码抛出错误“无法调用非委托类型”
var WshShell = AutomationFactory.CreateObject("WScript.Shell");
var WshSysEnv = WshShell.Environment("SYSTEM");
var foo = WshSysEnv("APPDATA");
如何获取环境变量?
编辑:
@ paulsm4 - 这适用于silverlight ......
var WshShell = AutomationFactory.CreateObject("WScript.Shell");
var appData = WshShell.ExpandEnvironmentStrings("%APPDATA%");
MessageBox.Show(appData);
答案 0 :(得分:1)
假设WSH,这样的事情怎么样:
Set wshShell = CreateObject( "WScript.Shell" )
WScript.Echo wshShell.ExpandEnvironmentStrings( "%APPDATA%" )
wshShell = Nothing