基本信息
源码名称:windows下定时关闭进程(应用程序)
源码大小:2.27KB
文件格式:.cpp
开发语言:C/C++
更新时间:2020-04-16
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 1 元 
   源码介绍

windows下定时关闭进程,挺好用,体积十分小

int main(int argc,char* argv[])
{
    if (argc == 1)
    {
        cout << "欢迎来到定时关闭应用程序!" << endl;
        cout << "--------------------------------------------------------------------" << endl << "/*帮助说明*/" << endl << "查找进程名或进程号方法:" << endl << "首先打开你想要定时关闭的应用," << endl << "使用快捷键ctrl alt . 打开任务管理器," << endl << "菜单栏中有个详细信息栏,点击," << endl << "然后根据图标识别哪个是你看中的进程,其名称列是进程名,pid列是进程号" << endl;
        cout << "--------------------------------------------------------------------" << endl << endl << "请输入进程名(不是进程号,例如:notepad.exe):";
        char a[500], b[1000], c[500], p[500], q[500];
        strcpy(b, "schtasks /create /tn dingshi /tr \"");
        strcpy(q, argv[0]);
        int j = 0;
        for (int i = 0; q[i]; i )
        {
            if (q[i] == '\\')
            {
                p[j ] = '\\';
                p[j ] = q[i];
            }
            else
            {
                p[j ] = q[i];
            }
        }
        p[j ] = ' ';
        p[j] = '\0';
        strcat(b, p);
        cin >> a;
        strcat(b, a);
        strcat(b, "\" /sc once /st ");
        cout << endl << "--------------------------------------------------------------------" << endl;
        cout << "时间输入的格式为:   时:分:秒   or    时:分    例如:" << endl;
        cout << "\"下午3点58分07秒 ------ 15:58:07     早上8点过10分 ------ 08:10\"" << endl;
        cout << "(请将输入法切换为英文,中文冒号':'不识别)" << endl;
        cout << "--------------------------------------------------------------------" << endl << endl;
        cout << "请输入你想程序定时关闭的时间:";
        cin >> c;
        system(strcat(b, c));
        system("pause");
        return 0;
    }
    if (argc == 2)
    {
        char a[500],b[500];
        strcpy(a, "taskkill /im ");
        strcpy(b, argv[1]);
        system(strcat(a, b));
        return 0;
    }
    return 0;
}