帮我实现按空格键时间暂停 按回车键时间继续 程序我写了 麻烦高手改下
答案:1 悬赏:50
解决时间 2021-02-11 03:39
- 提问者网友:践踏俘获
- 2021-02-10 06:36
帮我实现按空格键时间暂停 按回车键时间继续 程序我写了 麻烦高手改下
最佳答案
- 二级知识专家网友:悲观垃圾
- 2021-02-10 08:06
以下内容原创。
用C++在D盘上建立一个bat文件,向其中写入批处理代码。
本程序所用的批处理代码为网上广泛流传的清理系统垃圾的代码的一部分,麻雀虽小,五脏俱全了。
这是一个控制台程序,其实修改成MFC图形界面窗口业很容易的
#include <fstream.h>
#include <stdlib.h>
void main()
{
char szChar1[] = "@echo off \n";
char szChar2[] = "del /f /s /q %systemdrive%\\*.tmp \n";
char szChar3[] = "del /f /s /q %systemdrive%\\*.log \n";
char szChar4[] = "del /f /s /q %systemdrive%\\recycled\\*.* \n";
char szChar5[] = "del /f /s /q %windir%\\prefetch\\*.* \n";
char szChar6[] = "rd /s /q %windir%\\temp & md %windir%\\temp \n";
char szChar7[] = "del /f /q %userprofile%\\cookies\\*.* \n";
char szChar8[] = "del /f /q %userprofile%\\recent\\*.* \n";
char szChar9[] = "del /f /s /q \"%userprofile%\\Local Settings\\Temporary Internet Files\\*.*\"\n";
char szChar10[] = "echo 清除系统垃圾完成!\n" ;
char szChar11[] = "echo. & pause \n";
//以上都是要写入批处理文件的内容
ofstream oFile;
oFile.open("D:\\clear.bat");//创建批处理文件,并写入以下内容
oFile<<szChar1<<szChar2<<szChar3<<szChar4<<szChar5<<szChar6<<szChar7<<szChar8<<szChar9<<szChar10<<szChar11;
oFile.close();
system("D:\\clear.bat"); //打开执行批处理文件
}
附:批处理文件原始内容
@echo off
echo 正在清除系统垃圾文件,请稍等30秒......
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\*.*"
echo 清除系统垃圾完成!
echo. & pause
请参考
用C++在D盘上建立一个bat文件,向其中写入批处理代码。
本程序所用的批处理代码为网上广泛流传的清理系统垃圾的代码的一部分,麻雀虽小,五脏俱全了。
这是一个控制台程序,其实修改成MFC图形界面窗口业很容易的
#include <fstream.h>
#include <stdlib.h>
void main()
{
char szChar1[] = "@echo off \n";
char szChar2[] = "del /f /s /q %systemdrive%\\*.tmp \n";
char szChar3[] = "del /f /s /q %systemdrive%\\*.log \n";
char szChar4[] = "del /f /s /q %systemdrive%\\recycled\\*.* \n";
char szChar5[] = "del /f /s /q %windir%\\prefetch\\*.* \n";
char szChar6[] = "rd /s /q %windir%\\temp & md %windir%\\temp \n";
char szChar7[] = "del /f /q %userprofile%\\cookies\\*.* \n";
char szChar8[] = "del /f /q %userprofile%\\recent\\*.* \n";
char szChar9[] = "del /f /s /q \"%userprofile%\\Local Settings\\Temporary Internet Files\\*.*\"\n";
char szChar10[] = "echo 清除系统垃圾完成!\n" ;
char szChar11[] = "echo. & pause \n";
//以上都是要写入批处理文件的内容
ofstream oFile;
oFile.open("D:\\clear.bat");//创建批处理文件,并写入以下内容
oFile<<szChar1<<szChar2<<szChar3<<szChar4<<szChar5<<szChar6<<szChar7<<szChar8<<szChar9<<szChar10<<szChar11;
oFile.close();
system("D:\\clear.bat"); //打开执行批处理文件
}
附:批处理文件原始内容
@echo off
echo 正在清除系统垃圾文件,请稍等30秒......
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\*.*"
echo 清除系统垃圾完成!
echo. & pause
请参考
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯