批处理脚本删除的.ost大于50 GB [英] batch script delete .ost bigger than 50 GB
问题描述
我试图做一个批处理脚本删除的Outlook .ost文件比50GB大。但是,随着为命令让我抓狂循环:(
还与FORFILES命令,但没有luky尝试。
任何想法?
I'm trying to make a batch script to delete Outlook .ost files bigger than 50GB. But loops with "for" command makes me crazy :( Also try with "forfiles" command but no luky. Any idea?
丹尼斯嗨!
对不起,所以延迟退房......结果
我曾与小OST的测试它和作品......但IF命令不使用大文件...可达2GB〜。我试图用一个45GB的文件。
Hi Dennis!
Sorry for so delayed check out...
I have tested it with small ost's and works... but... the IF command don't work with large files... up to ~2GB. I tried with a 45GB file.
检查:
如果2147483647 2147483646 GTR回声大于B(将TRUE)
IF 2147483647 GTR 2147483646 echo A is greater than B (will be TRUE)
如果2147483648 GTR 2147483647回声大于B(将是假的!)
IF 2147483648 GTR 2147483647 echo A is greater than B (will be FALSE!)
就像展示在:
<一href=\"http://stackoverflow.com/questions/1199645/how-can-i-check-the-size-of-a-file-in-a-windows-batch-script\">How我可以检查文件的大小在Windows批处理脚本?
我想转换成GB但不工作:
I tried transform into GB but not work:
FORFILES / P%LOCALAPPDATA%\\微软\\展望/ S / M的.ost / CCMD / C组/一ostsize = @ FSIZE / 1073741824回声@file
FORFILES /P "%localappdata%\Microsoft\Outlook" /S /M *.ost /C "cmd /c set /a ostsize=@fsize/1073741824 echo @file"
但无法正常工作,然后发现有一个与FORFILES命令一个问题:
But not work, then found that there is a problem with forfiles command:
FORFILES / P%LOCALAPPDATA%\\微软\\展望/ S / M的.ost / CCMD / C =回声@ FSIZE
FORFILES /P "%localappdata%\Microsoft\Outlook" /S /M *.ost /C "cmd /c echo=@fsize"
有45GB的文件试试吧,返回值8052032512 ...:S I很卡
Try it with a 45GB file and returns 8052032512 value... :S I'm stuck!
推荐答案
好吧,我找到了解决办法:WMIC营救!!!!
Ok, I found the solution: WMIC to rescue!!!!
做一个WMIC查询并投入变量:
Do a wmic query and put into a variable:
for /f "tokens=2 delims==" %%f in ('wmic datafile where "path='\\Users\\%username%\\AppData\\Local\\Microsoft\\Outlook\\' and Extension='ost' and FileSize>'48318382080'" get Name /value ^| find "="') do set "file=%%f"
这篇关于批处理脚本删除的.ost大于50 GB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!