Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("1.txt", ForAppending, True)
objTextFile.WriteLine "set objswbemservices=objlocator.connectserver(".", ""root/cimv2"", "", "")"
objTextFile.Close
行: 4
字符 :72
错误: 缺少标识符
代码:800A03F2
vb的字符串中用两个引号表示一个引号,第4行第72字符和后面点号后的引号都是用的一个。第四行应改为
objTextFile.WriteLine "set objswbemservices=objlocator.connectserver(""."", ""root/cimv2"", "", "")"
objTextFile.WriteLine "set objswbemservices=objlocator.connectserver(""."", ""root/cimv2"", "", "")"
温馨提示:答案为网友推荐,仅供参考
第1个回答 2010-04-12
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("1.txt", 8, True)
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer(".", "root/cimv2", "", "")
Set objWEBMCol = objService.InstancesOf("Win32_Account")
For Each objWEBM in objWEBMCol
objTextFile.WriteLine "账号: " & objWEBM.Caption
objTextFile.WriteLine "描述: " & objWEBM.Description
objTextFile.WriteLine "域名: " & objWEBM.Domain
objTextFile.WriteLine "安全ID: " & objWEBM.SID
objTextFile.WriteLine "安全ID类型: " & objWEBM.SIDType
objTextFile.WriteLine "状态: " & objWEBM.Status
Next本回答被网友采纳
Set objTextFile = objFSO.OpenTextFile ("1.txt", 8, True)
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer(".", "root/cimv2", "", "")
Set objWEBMCol = objService.InstancesOf("Win32_Account")
For Each objWEBM in objWEBMCol
objTextFile.WriteLine "账号: " & objWEBM.Caption
objTextFile.WriteLine "描述: " & objWEBM.Description
objTextFile.WriteLine "域名: " & objWEBM.Domain
objTextFile.WriteLine "安全ID: " & objWEBM.SID
objTextFile.WriteLine "安全ID类型: " & objWEBM.SIDType
objTextFile.WriteLine "状态: " & objWEBM.Status
Next本回答被网友采纳