本帖最后由 terse 于 2023-4-25 01:44 编辑
- @if(0)==(0) echo off
- cscript -NoLogo -E:JScript %0 <a.txt
- pause & exit
- 文件有中文情况,存为ANSI格式
- @end
- var text =WSH.StdIn.ReadAll();
- var arr=text.match(/\{.*?\}/g)
- for (i = 0, len=arr.length; i<len; i++) {
- var obj = new Function("return" + unescape(arr[i]))();
- WSH.Echo(obj.fileId,obj.fileName,obj.fileSize);
- }
复制代码
- powershell "((sls -Path .\aa.txt -Pattern '\{.*?\}' -AllMatches ).Matches.Value|ConvertFrom-Json|group fileId,fileName,fileSize).name"
复制代码 另一种格式的话- @if(0)==(0) echo off
- cscript -NoLogo -E:JScript %0 <a.txt
- pause & exit
- 文件有中文情况,存为ANSI格式
- @end
- var text =WSH.StdIn.ReadAll();
- var obj = new Function("return" + unescape(text))();
- var arr = obj.data;
- for (i = 0, len=arr.length; i<len; i++) {
- WSH.Echo(arr[i].fileId,arr[i].fileName,arr[i].fileSize);
- }
复制代码
|