[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
PowerShell
保存为ps1扩展名文件,右键单击脚本,以powershell运行
未对powershell进行过设置的,可以管理员身份运行CMD,复制此命令到命令提示符 powershell -c "set-executionpolicy unrestricted" 以解除脚本限制
WIN10以下系统如出错,可能需要去微软官网下载补丁升级powershell

根据5楼的要求,更新了下代码
  1. $SD_eng=Get-ChildItem -Path "C:\Users\CH6\Desktop\TEDTXTUNICODE\eng1246"
  2. $SD_chs=Get-ChildItem -Path "C:\Users\CH6\Desktop\TEDTXTUNICODE\chs1203"
  3. $OD_merge="C:\Users\CH6\Desktop\TEDTXTUNICODE\merge"
  4. foreach($file_eng in $SD_eng){
  5.      $content=$content_eng=$content_chs=$null;
  6.      foreach($file_chs in $SD_chs){
  7.         if($file_eng.name -eq $file_chs.name){
  8.             $content_eng=Get-Content -Path $file_eng.FullName;
  9.             $content_chs=Get-Content -Path $file_chs.FullName;
  10.             break;
  11.         }#if
  12.       }#for2  
  13.       if(($content_eng.Count-$content_chs.Count) -ge 0){$count=$content_eng.Count}else{$count=$content_chs.Count;}
  14.      for($i=2;$i -le $count;$i+=4){
  15.         if ($content_eng[$i-2] -ne $content_chs[$i-2]){-join('文件',$file_eng.name,"`t在第",(($i-2)/4+1),'行号不对应');}
  16.         if ($content_eng[$i-1] -ne $content_chs[$i-1]){-join('文件',$file_eng.name,"`t在第",(($i-2)/4+1),'时间轴不对应');}
  17.         if(!($content_eng[$i])){-join('文件',$file_eng.name,"`t在第",(($i-2)/4+1),'无英文字幕');}
  18.         if(!($content_chs[$i])){-join('文件',$file_eng.name,"`t在第",(($i-2)/4+1),'无中文字幕');}
  19.         $content+=-join($content_eng[$i]," ",$content_chs[$i]+"`r`n");
  20.       }
  21.       if($content){$OF_name=$OD_merge+'\'+$file_eng.name;$content|Out-File -FilePath $OF_name;}
  22. }
  23. pause;
复制代码

TOP

回复 5# allenyzq147
更新后的代码还放在二楼

TOP

返回列表