Javascript 有没有办法在jscript中使用GetProfilesDirectory?

Javascript 有没有办法在jscript中使用GetProfilesDirectory?,javascript,user-profile,Javascript,User Profile,如何使用GetProfilesDirectory在Jscript中检索c:\Documents和Settings或c:\Users(对于vista和win7) 或者以任何其他方式获取用户配置文件路径(不是当前用户的路径),但用于非广告场景中的任何给定用户 您不能在JScript中使用GetProfilesDirectory函数,因为Windows脚本主机不支持调用Windows API函数。但是,您可以从HKEY\U LOCAL\U MACHINE\SOFTWARE\Microsoft\Wind

如何使用GetProfilesDirectory在Jscript中检索c:\Documents和Settings或c:\Users(对于vista和win7)


或者以任何其他方式获取用户配置文件路径(不是当前用户的路径),但用于非广告场景中的任何给定用户

您不能在JScript中使用
GetProfilesDirectory
函数,因为Windows脚本主机不支持调用Windows API函数。但是,您可以从
HKEY\U LOCAL\U MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory
注册表值获取配置文件目录路径。下面是一个例子:

var oShell = new ActiveXObject("WScript.Shell");
var strProfilesDir = oShell.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\ProfilesDirectory");
strProfilesDir = oShell.ExpandEnvironmentStrings(strProfilesDir);

WScript.Echo(strProfilesDir);
或者以任何其他方式获取用户配置文件路径(不是当前用户的路径),但用于非广告场景中的任何给定用户


上述
ProfileList
注册表项具有对应于不同用户的子项。用户的配置文件路径由相应子项的
ProfileImagePath
值指定。

您不能在JScript中使用
GetProfilesDirectory
函数,因为Windows脚本主机不支持调用Windows API函数。但是,您可以从
HKEY\U LOCAL\U MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory
注册表值获取配置文件目录路径。下面是一个例子:

var oShell = new ActiveXObject("WScript.Shell");
var strProfilesDir = oShell.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\ProfilesDirectory");
strProfilesDir = oShell.ExpandEnvironmentStrings(strProfilesDir);

WScript.Echo(strProfilesDir);
或者以任何其他方式获取用户配置文件路径(不是当前用户的路径),但用于非广告场景中的任何给定用户

上述
ProfileList
注册表项具有对应于不同用户的子项。用户的配置文件路径由相应子键的
ProfileImagePath
值指定。

Related:Related: