为什么我在CMD和VBS之间获得不同的结果?
当我在CMD提示符中发布以下命令时,将返回Adapterram对象的正确值:
WMIC Path Win32_VideoController Get AdapterRAM
返回8589934592的正确值。但是,当我使用相同查询的VBScript使用VBScript时,将返回相同的apperram对象的不正确值:
sPC = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sPC & "\root\cimv2")
Set cSettings = objWMIService.ExecQuery("Select AdapterRAM From Win32_VideoController Where DeviceID='VideoController1'")
For Each oPC in cSettings
GPURAMSize = oPC.AdapterRAM
WScript.Echo GPURAMSize
Next
与同一Adapterram对象返回-1048576的不正确值。
我在这里错过了什么吗?为什么从CMD提示与VBScript使用相同的查询之间返回的值差异?
提前致谢。
When I issue the following command in a CMD prompt, the correct value is returned for the AdapterRAM object:
WMIC Path Win32_VideoController Get AdapterRAM
The correct value of 8589934592 is returned. However when I utilize VBScript with the same query, an incorrect value is returned for the same AdapterRam object:
sPC = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sPC & "\root\cimv2")
Set cSettings = objWMIService.ExecQuery("Select AdapterRAM From Win32_VideoController Where DeviceID='VideoController1'")
For Each oPC in cSettings
GPURAMSize = oPC.AdapterRAM
WScript.Echo GPURAMSize
Next
The incorrect value of -1048576 is returned for the same AdapterRAM object.
Am I missing something here? Why the difference in values returned between utilizing the same query from a CMD prompt versus a VBScript?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
thanx在所有提出评论的人的所有帮助下,但大多数用户692942提供了帮助我解决问题的链接。这是我想到的...
Thanx to all the help from everyone that has contributed comments, but most especially user 692942 for providing the link that helped me solve the problem. Here's what I came up with...