从 Windows CLI 刷新磁盘写入缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/85595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:13:46  来源:igfitidea点击:

Flush disk write cache from Windows CLI

windowscachingcommand-line-interfacediskflush

提问by Brian

Does anyone know how to flush the disk write cache data from the cache manager for the current directory (or any given file or directory, for that matter), from a Windows command line?

有谁知道如何从 Windows 命令行从缓存管理器为当前目录(或任何给定的文件或目录)刷新磁盘写入缓存数据?

采纳答案by OldCurmudgeon

I found the SysInternals Syncworked well for me - although it flushes ALL cache, not just for the specific folder.

我发现 SysInternals Sync对我来说效果很好——尽管它会刷新所有缓存,而不仅仅是针对特定文件夹。

Example of usage:

用法示例:

IF EXIST Output RD /S /Q Output && Sync && MD Output

By default it flushes all cached data for all drives - you can specify command-line options to restrict which drives but you cannot restrict it to just specific folders.

默认情况下,它会刷新所有驱动器的所有缓存数据 - 您可以指定命令行选项来限制哪些驱动器,但不能将其限制为仅特定文件夹。

Without it I would often get Access deniederrors because the MDwas trying to create a new folder while the system was still in the process of deleting the old one.

没有它,我经常会遇到Access denied错误,因为它MD试图在系统仍在删除旧文件夹的过程中创建一个新文件夹。