[英]how to get the details of USB devices connected to computer using java
I am trying to get the details of USB hardware devices connected to computer but I don't know the native code of windows so is it possible to get the details of hardware connected to computer using JAVA Thanks in advance 我正在尝试获取连接到计算机的USB硬件设备的详细信息,但我不知道Windows的本机代码,因此可以使用JAVA获取连接到计算机的硬件的详细信息吗?
vbscript code: vbscript代码:
Set HDs = GetObject("winmgmts:(impersonationLevel=impersonate)")
Set colItem=HDs.ExecQuery("Select * from Win32_DiskDrive")
For Each hd In colItem
Wscript.Echo hd.PnPDeviceID & "vigi"
Next
java code: Java代码:
try {
Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = input.readLine()) != null) {
result += line;
}
input.close();
} catch(Exception e){
e.printStackTrace();
}
now i'm trying to get the details using this vbscipt code but when i'm executing this code the error comes no script found 现在,我正在尝试使用此vbscipt代码获取详细信息,但是当我执行此代码时,出现错误,没有找到脚本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.