cleanmgr [/d
参数 说明
/d
注意:/d选项不与 一起使用 。
/sageset:n 显示"磁盘设置"对话框,并创建一个注册表项来存储你选择的设置。 通过存储在注册表中的 值,可以指定要运行 n 磁盘清理的任务。 该值 n 可以是从 0 到 9999 的任何整数值。
/sagerun:n 如果使用 /sageset 选项,则运行分配给 n 值的指定任务。 将枚举计算机上的所有驱动器,并且所选配置文件针对每个驱动器运行。
/tuneup:n 为同一 运行 /sageset和 /sagerun。
/lowdisk 使用默认设置运行 。
/verylowdisk 使用默认设置运行,无用户提示。
/? 在命令提示符下显示帮助。
Syntax
CLEANMGR [/d driveletter] option
CLEANMGR [/d driveletter] /sageset:n option
CLEANMGR [/d driveletter] /sagerun:n option
Options
/D driveletter The drive that you want Disk Cleanup to clean.
NOTE: The /d option is not utilized with /SAGERUN:n.
Specify the %systemroot% drive to see all the available options.
/SAGESET:n Display the Disk Cleanup Settings dialog box and create
a registry key to store the settings you select.
REQUIRES ELEVATION
The n value is stored in the registry and allows you to
specify different tasks for Disk Cleanup to run.
n can be any integer from 0 to 9999.
/SAGERUN:n Run task 'n'
All drives in the computer will be enumerated, and the
selected profile will be run against each drive.
/TUNEUP:n Run /sageset and /sagerun for the same n
/LOWDISK Disk Cleanup will open with all options checked.
Normally invoked when Windows notifies that of disk space is running out.
/VERYLOWDISK Disk Cleanup will open with all options checked, no user prompts.
/SETUP Analyze the system files left over from a previous Windows version. [Undocumented]
/Autoclean Analyze the system files left over from a previous Windows version/in-place upgrade.
and also remove those files automatically. [Undocumented]
/HELP Display help
/USAGE Display help
/? Display help
If CLEANMGR is run without /sageset or /sagerun, it will start by calculating how much disk space could be saved. This makes the process slower to startup.
Although many of these files are often described as "junk" you should carefully evaluate what they do before deleting them. By default only the Downloaded Program Files and Temporary Internet Files will be selected.
Having a hard drive that is over 75% - 80% full will affect performance because file fragmentation (and automatic defragmentation) will increase. Also assuming you have the default 'system managed size' for the page file, that will automatically shrink to fit in the available space. For a drive that has more than 25% free space, deleting files will not make any difference to performance.
Some cleanup options require elevation, when run without elevation the GUI will include an option [Clean up System Files] which will relaunch CLEANMGR in Elevated mode. When necessary CLEANMGR can take ownership of the files before deleting them.
To enable Cleanmgr on older servers of Windows Server, open Server Manager and choose Add feature, then select "Desktop Experience"
After running cleanmgr on a server you may want to disable "Desktop Experience" again.
Cleanup Settings: Files to delete
The following options can be toggled on or off when running /SAGESET:n
Branch Cache
Catalog Files for the Content Indexer
Compress Old Files
Delivery Optimization Files
Diagnostic data viewer database files
DirectX Shader cache
Downloads (Personal downloads folder)
Downloaded Program Files *
Language resources Files
Offline Files
Old Chkdsk Files
Recycle Bin * (empties the recycle bin to recover the disc space)
Retail Demo Offline Content
Setup Log files
System Error memory dump files
System Error minidump files
Temporary Files
Temporary Internet Files *
Temporary Setup Files
Temporary Offline Files
Thumbnails
Update package Backup Files
User file history
Windows Defender Antivirus
Windows error reports and feedback diagnostics
Windows Update Cleanup
Windows Upgrade log files
Items marked with * have a [View Files] option in the GUI to view the individual files.
The Recycle Bin and Catalog Files for the Content Indexer may appear for more than one drive.
Application Data
The user's 'Application Data' folder is not available for cleanup in the above list. Many files in Application Data hold system data that should not be deleted. However if you have an application that leaves a significant number of temporary/junk files in App Data, these can be selectively removed from a roaming profile with a VBScript like this.
Recent files
The 'User Profile/Recent Items' folder can contain many more shortcuts than are useful. A very large number of these can affect logon/logoff times. To clear out the shortcuts:
CD %userprofile%\AppData\Roaming\Microsoft\Windows\Recent
Echo y| del *.*
Close Locked files by restarting Windows Explorer
Save the following batch script:
@Echo off
Taskkill /f /im Explorer.exe
Start Explorer.exe
Exit
Then to restart Windows Explorer, just run the batch file.
Registry
Registry settings for CLEANMGR are held in:
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches]
Here are a set of registry entries to turn on a typical selection of cleanmgr options, these can be used with REG or Regedit to pre-populate the regisitry as a scriptable alternative to running /SAGESET
Log files for CLEANMGR are stored in:
C:\Windows\System32\LogFiles\setupcln\
Examples
Choose a set of options for cleanup (this will display the GUI) and Save as settings group #64:
CLEANMGR /sageset:64
Run the saved settings group #64
CLEANMGR /sagerun:64
To run Disk Cleanup this way regularly, you can create a shortcut which can be run from the Windows Startup folder or via a regular schedule. To run the saved settings group #64
%systemroot%\system32\cmd.exe /c CLEANMGR /sagerun:64
腾图小抄 SCWY.net v0.03 小抄561条 自2022-01-02访问365599次