import console; import process.popen; subprocess = process.popen("netsh wlan show interfaces") var wlan = {}; var pattern = "\s{4}(.+)\s{6}\:(.+)"; var line = subprocess.read(); while(line){ for k,v in string.gmatch( line, pattern ){ wlan[string.trim(k)] = string.trim(v); } line = subprocess.read(); } subprocess.close(); console.printf("SSID:%s", wlan.SSID) console.log("--------------------------------") for(k,v in wlan){ console.printf("%s:%s", k, v) } console.pause(true);
标签:console,ssid,aardio,wifi,subprocess,var,wlan,line,string From: https://www.cnblogs.com/popdes/p/16704529.html