//aardio 调用进程管道 - 分行模式匹配 import console; import process.popen; /* 进程管道相关范例目录: 范例 » 文件操作 » 进程管道 范例 » 自动化 » 进程操作 » 进程管道 范例 » 调用其他语言 » 批处理与命令行 */ var prcs = process.popen("ipconfig");//获取网卡 TCP/IP 网络配置值 var tab = {}; var current = tab; //使用分行模式匹配解析带缩进格式的命令行输出并转换为表对象 for indent,name,value in prcs.lines("^(\s*)(\S.*?)[\s.]*\:(.*)"){ if(!#indent){ current = {}; tab[name] = current; } else { current[name] = value; } } console.dumpJson(tab); console.pause(true);