本帖最后由 WHY 于 2017-4-9 15:37 编辑
不知道是不是这个意思,试试吧- @if(0)==(0) echo off
- set "key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners"
- reg query "%key%" /s /ve | cscript //nologo //e:jscript "%~f0" > Result.Log
- pause & goto :EOF
- @end
-
- var str = WSH.StdIn.ReadAll();
- var reg = /HKEY_.+\\([^\\]+_[0-9a-f]{16}_)([^\\]+)\\([0-9.]+)\r\n.+REG_SZ\s+([0-9.]+)/g;
- var map = [], arr = [];
-
- while(arr = reg.exec(str)){
- var s1 = arr[1] + arr[2];
- if(!map[s1]) map[s1] = [[],[]];
- map[s1][0].push(arr[1] + arr[3]);
- map[s1][1].push(arr[1] + arr[4]);
- }
-
- for(var key in map){
- var len = map[key][0].length;
- WSH.Echo( len > 1 ? map[key][1].join('\r\n') : map[key][0] )
- }
复制代码
|