在Classic ASP中获取环境变量 [英] Getting environment variables in Classic ASP

查看:154
本文介绍了在Classic ASP中获取环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用VBScript在经典的ASP页面中获取自定义环境变量的值?

How can I get the value of a custom environment variable in a classic ASP page using VBScript?

推荐答案

您可以使用WScript.Shell对象的ExpandEnvironmentStrings方法来检索环境变量.以下代码将PATH环境变量的值分配给var myPath:

You can use the ExpandEnvironmentStrings method of the WScript.Shell object to retrieve environment variables. The following code will assign the value of the PATH environment variable to var myPath:

set foo = createobject("WScript.Shell")
myPath = foo.ExpandEnvironmentStrings("%PATH%")

有关作为MSDN的Shell对象的详细信息

必须更改将外壳对象分配给的变量.

Had to change the variable to which the shell object is assigned.

这篇关于在Classic ASP中获取环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆