[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 zaqmlp 于 2022-4-9 23:51 编辑
  1. <# :
  2. cls&echo off&cd /d "%~dp0"
  3. powershell -NoProfile -ExecutionPolicy bypass "[IO.File]::ReadAllText(\"%~f0\",[Text.Encoding]::GetEncoding('GB2312'))|Invoke-Expression"
  4. pause
  5. exit
  6. #>
  7. $outfile=".\all.csv";
  8. $codes=@'
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Runtime.InteropServices;
  12. public static class ExpDir
  13. {
  14.     [DllImport("Shlwapi.dll", CharSet=CharSet.Unicode)]
  15.     public static extern int StrCmpLogicalW(string p1, string p2);
  16.     public static string[] Sort(string[] f)
  17.     {
  18.         Array.Sort(f, StrCmpLogicalW);
  19.         return f;
  20.     }  
  21. }
  22. '@;
  23. Add-Type -TypeDefinition $codes;
  24. [System.Collections.ArrayList]$s=@();
  25. $folders=@(dir -literal "."|?{$_ -is [System.IO.DirectoryInfo]});
  26. for($i=0;$i -lt $folders.length;$i++){
  27.     write-host $folders[$i].Name;
  28.     $files=@(dir -literal $folders[$i].FullName|?{$_ -is [System.IO.FileInfo]}|%{$_.Name});
  29.     if($files.length -ge 1){
  30.         $arr=[ExpDir]::Sort($files);
  31.         $line=@($arr|%{'"'+$folders[$i].FullName+'\'+$_+'"'}) -join "`t";
  32.         [void]$s.add($line);
  33.     }
  34. }
  35. [IO.File]::WriteAllLines($outfile, $s, [Text.Encoding]::Unicode);
复制代码
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

回复 6# xiaohutok1


    已修改
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

返回列表