Board logo

标题: [系统相关] BAT脚本批量当前目录下的的文件夹大小怎么记录数据到一个文本内? [打印本页]

作者: idc878787    时间: 2022-12-4 07:43     标题: BAT脚本批量当前目录下的的文件夹大小怎么记录数据到一个文本内?

这个bat 批量当前目录下的的文件夹大小怎么 记录数据到一个文本内?
  1. @echo off
  2. REM setlocal enabledelayedexpansion
  3. cd /d "%~dp0"
  4. for /f "delims=" %%a in ('dir /b /ad') do (
  5.     set /p =%%a: <nul
  6.     powershell -c "(Get-ChildItem -Path '%%a' -Force -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum"
  7. )
  8. pause
复制代码

作者: hfxiang    时间: 2022-12-4 08:12

  1. @echo off
  2. REM setlocal enabledelayedexpansion
  3. cd /d "%~dp0"
  4. (for /f "delims=" %%a in ('dir /b /ad') do (
  5.     set /p =%%a: <nul
  6.     powershell -c "(Get-ChildItem -Path '%%a' -Force -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum"
  7. ))>1.txt
复制代码
输出结果到1.txt文档中
作者: idc878787    时间: 2022-12-4 08:21

回复 2# hfxiang


    谢谢




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2