返回用户的域名。
object.UserDomain
字符串。
如果未设置 USERDOMAIN 环境变量,则 UserDomain 属性不能在 Windows98 和 Windows ME 中运行。默认情况下不设置该变量。
下面的示例演示 UserDomain 属性的用法:
<package> <job id="vbs"> <script language="VBScript"> Set WshNetwork = WScript.CreateObject("WScript.Network") WScript.Echo "Domain = " & WshNetwork.UserDomain
WScript.Echo "Computer Name = " & WshNetwork.ComputerName WScript.Echo "User Name = " & WshNetwork.UserName </script> </job> <job id="js"> <script language="JScript"> var WshNetwork = WScript.CreateObject("WScript.Network"); WScript.Echo("Domain = " + WshNetwork.UserDomain
); WScript.Echo("Computer Name = " + WshNetwork.ComputerName); WScript.Echo("User Name = " + WshNetwork.UserName); } </script> </job> </package>