大佬教程收集整理的这篇文章主要介绍了windows – 在批处理脚本中执行目录列表时速度很慢,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
REM the below line lists the folder names that are to be read FOR /F "TOKENS=* DELIMS=" %%d in (%start_dir%\folder_list.txt) DO ( ECHO Entering into: %%d Directory REM The below line lists the folders and all of it's subfolders. It than outputs it to a file. FOR /F "TOKENS=* DELIMS=" %%e in ('DIR /s "%work_dir%\%%d"') DO ( ECHO %%e>>%start_dir%\tmp_folder\%%d.size ) )@H_197_19@上面的代码有效. @H_197_19@问题出在这里:如果我的文件夹大小只有几GB,那就没问题了. @H_197_19@如果我有一个超过100GB的文件夹,脚本将花费大约一个小时来输出DIR / S>> %% d命令. @H_197_19@当我在大约150GB的单个文件夹上运行时:Dir / s“150GB_Folder”>> dir_ouput_file.txt它在大约6-10秒内完成. @H_197_19@我的问题是:为什么从脚本中输出DIR /S\u0026gt;\u0026gt;whatever.txt需要一个小时,而它不在脚本中只需要几秒钟? @H_197_19@先感谢您!
REM the below line lists the folder names that are to be read FOR /F "TOKENS=* DELIMS=" %%d in (%start_dir%\folder_list.txt) DO ( ECHO Entering into: %%d Directory REM The below line lists the folders and all of it's subfolders. It than outputs it to a file. DIR /s "%work_dir%\%%d" >%temp%\temp.tmp FOR /F "TOKENS=* DELIMS=" %%e in (%temp%\temp.tmp) DO ( ECHO %%e>>%start_dir%\tmp_folder\%%d.size ) del %temp%\temp.tmp )
以上是大佬教程为你收集整理的windows – 在批处理脚本中执行目录列表时速度很慢全部内容,希望文章能够帮你解决windows – 在批处理脚本中执行目录列表时速度很慢所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。