本帖最后由 yhcfsr 于 2018-5-25 21:19 编辑
powershell- $cd='d:\test';
- $files=(dir $cd -r -force |?{$_.CreationTime.Date -eq (Get-Date).Date});
- foreach($file in $files){
- $file.fullname;
- $size+=$file.Length;
- };
- '今天创建的文件共: '+"{0:n2}" -f ($size/1GB)+' GB';
复制代码 BAT+POWERSHELL- @echo off
- powershell ^
- $cd='d:\test';^
- $size=$null;^
- $files=(dir $cd -r -force ^|?{$_.CreationTime.Date -eq (Get-Date).Date});^
- foreach($file in $files){^
- $file.fullname;^
- $size+=$file.Length;^
- };^
- '今天创建的文件共: '+'{0:n2}' -f ($size/1GB)+' GB';^
- exit
- pause
复制代码 回复3楼- @echo off
- set "sum=0"&set "sd=d:\test"
- cd /d "%sd%"
- for /r %%a in (*) do (
- for /f "delims= " %%b in ('dir /a-d/tc "%%a"^|findstr /ri "%date%"') do (
- echo;%%a
- call,set "sum=%%sum%%+%%~za"
- )
- )
- set "command=powershell -c '{0:n2}' -f ((%sum%^)/1GB^)"
- for /f "delims= " %%a in ('%command%') do echo;今天创建的文件共: %%a GB
- pause
复制代码
|