我可以在vbscript WSH脚本中接听环境变量吗? [英] Can I pick up environment variables in vbscript WSH script?

查看:122
本文介绍了我可以在vbscript WSH脚本中接听环境变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在Windows脚本宿主(WSH)VBS脚本中读取系统环境变量吗?

Is is possible to read system environment variables in a Windows Scripting Host (WSH) VBS script?

(我正在使用Windows脚本宿主编写一个VBScript,用于任务一个巡航控制,并希望获取项目构建URL。)

(I am writing a VBScript using Windows Scripting Host for task for a Cruise Control and want to pick up the project build URL.)

推荐答案

这是一个例子(取自 here ):

Here's an example (taken from here):

Set oShell = CreateObject( "WScript.Shell" )
user=oShell.ExpandEnvironmentStrings("%UserName%")
comp=oShell.ExpandEnvironmentStrings("%ComputerName%")
WScript.Echo user & " " & comp

这篇关于我可以在vbscript WSH脚本中接听环境变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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