怎样设置电脑关机前清理电脑垃圾
每天清理垃圾是件非常麻烦的事情,但是每天不清理电脑垃圾电脑运行速度就慢,怎么办呢?很简单,让电脑在关机前自动清理垃圾就好啦!设置好了以后,你关机,它就开始自己清理自己了,清理完了以后就自动关机了,是不是很方便,赶紧来试试吧!
怎样设置电脑关机前清理电脑垃圾
第一部分:建立一个清理系统的批处理命令
首先点击开始——所有程序

我们点击附件。

在附件中找到记事本,点击记事本。

打开了一个记事本,我们在记事本中输入如下代码:笔者懒得写代码了,从网上找到现成的,测试没问题,该代码的意思就是删除系统垃圾
@echo off
del /f /s /q %systemdrive%*.tmp
del /f /s /q %systemdrive%*._mp
del /f /s /q %systemdrive%*.log
del /f /s /q %systemdrive%*.gid
del /f /s /q %systemdrive%*.chk
del /f /s /q %systemdrive%*.old
del /f /s /q %systemdrive%recycled*.*
del /f /s /q %windir%*.bak
del /f /s /q %windir%prefetch*.*
rd /s /q %windir%temp & md %windir%temp
del /f /q %userprofile%cookies*.*
del /f /q %userprofile%recent*.*
del /f /s /q "%userprofile%Local SettingsTemporary
Internet Files*.*"
del /f /s /q "%userprofile%Local SettingsTemp*.*"
del /f /s /q "%userprofile%recent*.*"

5点击文件——另存为。

6把该文件存在一个不宜被修改的地方,笔者放在了C盘的program files文件夹里。我们把这个文件名改为 清理系统垃圾.bat,记住我们文件的格式为bat。保存类型设置为所有文件。

7关闭记事本即可。

END
第二部分:设置关机启动
首先按快捷键win+r,打开运行。

输入gpedit.msc,然后点击确定。

依次展开计算机配置——windows设置——脚本。

在右边我们看到了关机选项,双击它。

在关机属性中,我们点击添加。

添加脚本面板,我们点击浏览。

在浏览中找到你新建的清理系统垃圾文件,如图所示,点击打开。

回到了添加脚本面板,我们点击确定即可完成设置。
