日期:2014-05-20 浏览次数:20938 次
import com.sun.jna.platform.win32.Advapi32Util;
import com.sun.jna.platform.win32.Netapi32Util;
public class JnaTest {
/**
* @param args
*/
public static void main(String[] args) {
Netapi32Util.User[] users = Netapi32Util.getUsers();
System.out.println("用户数量: " + users.length);
System.out.println();
for (Netapi32Util.User user : users) {
System.out.println("账户名称:" + user.name);
Advapi32Util.Account account = Advapi32Util
.getAccountByName(user.name);
System.out.println("账户全名:" + account.fqn);
System.out.println("账户SID:" + account.sidString);
System.out.println();
}
}
}
public static void main(String[] args) {调用cmd命令来执行。。。完美的三连
Runtime run = Runtime.getRuntime();
try {
run.exec("cmd net user ");
} catch (Exception e) {
e.printStackTrace();
}
}
NET LOCALGROUP Administrators