如何从VBScript获取程序文件环境设置

Jer*_*emy 6 vbscript environment-variables

在批处理文件中,您可以使用%PROGRAMFILES%来获取程序文件目录的位置,如何在VBScript中执行此操作?

Jon*_*röm 16

Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
Run Code Online (Sandbox Code Playgroud)


Biz*_*rck 6

要获取程序文件(x86),请使用:

Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")
Run Code Online (Sandbox Code Playgroud)