vbscript - 我可以在 vbscript WSH 脚本中获取环境变量吗?

标签 vbscript environment-variables wsh

是否可以在 Windows Scripting Host (WSH) VBS 脚本中读取系统环境变量?

(我正在使用 Windows Scripting Host 为 Cruise Control 的任务编写 VBScript,并希望获取项目构建 URL。)

最佳答案

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

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

关于vbscript - 我可以在 vbscript WSH 脚本中获取环境变量吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/904739/

相关文章:

vbscript - 使用 VBScript 通过 Twilio HTTP POST 发送 SMS

javascript - 打印网页没有任何提示?使用 javascript 或 jquery 或 vbscript

powershell - PowerShell 中名称中带有点 (.) 的环境变量

powershell - 自托管 gitlab 运行器。 PATH 环境变量的内容与常规 powershell 不同

programming-languages - 为 Windows 脚本宿主 (WSH) 编写语言

css - 是否可以在 Windows 上从 WSH 运行 CSLint?

html - 隐藏表行经典的ASP

windows-vista - vbscript检测UAC是否提升

javascript - dotenv-webpack 是否将 .env 中的所有环境变量暴露给前端?

windows-7 - 如何获取系统的计算机名称并将其输出到 VBScript 中的文件