C盘清理代码【搬代码】

在桌面创建txt文件,并将下面内容粘贴进去,将文件的.txt改成.bat
然后双击运行即可

@echo off
echo正在清除系统垃圾文件,请稍等......
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 Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /f /s /q C:\Windows\Temp\*.*
del /f /s /q C:\Windows\SoftwareDistribution\Download\*.*
del /f /s /q C:\Windows\Prefetch\*.*
echo清除系统LJ完成!
echo. & pause

其中del /f /s /q C:\Windows\Prefetch\*.*
是会将你运行过的软件痕迹清理,
比如:你运行了QQ或者其他app,再次打开速度很快,是因为数据文件存储了一下在这个文件夹中,等你下次再次打开的时候会很快跳到你经常用的页面,
如果删除后,再次打开会很慢,因为他需要重新记录,以后就会很快了
如果有重要操作记录可以将这行代码删除掉在执行

  • 8
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: #include <stdio.h> int main() { char file[100]; printf("请输入要清除的文件路径: "); scanf("%s", file); if( remove( file ) == 0 ) printf("文件已删除成功\n"); else printf("文件删除失败\n"); return 0; } ### 回答2: 以下是一段使用C语言编写的清除C盘文件的代码: ```c #include <stdio.h> #include <stdlib.h> int main() { // 指定要删除的文件路径(此处为C盘根目录下的test.txt文件) char file_path[] = "C:\\test.txt"; // 删除文件 if (remove(file_path) == 0) { printf("文件删除成功!\n"); } else { printf("文件删除失败!\n"); } return 0; } ``` 以上代码中,我们使用`remove()`函数来删除指定路径的文件。你可以将`file_path`变量的值修改为你要删除的文件路径,以清除其他文件。值得注意的是,删除C盘或其他重要文件可能会对系统造成严重影响,请谨慎使用此代码。 ### 回答3: 清理C盘文件的C语言代码如下: ```c #include <stdio.h> #include <string.h> void clearCDrive() { char command[100]; strcpy(command, "del C:\\*.* /f /s /q"); system(command); } int main() { printf("开始清理C盘文件...\n"); clearCDrive(); printf("C盘文件清理完成!\n"); return 0; } ``` 这段代码定义了一个`clearCDrive()`函数,该函数使用系统命令`del C:\\*.* /f /s /q`清除C盘下的所有文件。然后,在`main()`函数中调用`clearCDrive()`函数来执行清理操作。运行程序后,会输出相关提示信息,并在操作完成后显示清理完成的消息。请注意,这段代码使用`system()`函数调用系统命令,因此需要在Windows操作系统中运行。但请注意,清除C盘文件是非常危险的行为,请谨慎操作,确保你知道自己在做什么,并备份重要文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值