• VC程序快速删除自己(可能做升级程序的时候有用)


    项目一般都会带有卸载程序,如果这个程序是自己来做的话,在调用完卸载程序后需要删除自己的所有文件,在Google了好久终于找到一些相关信息,一般只能删除一个文件,经过自己的处理,可以删除文件夹下面所有内容,也可包含子文件夹。

    主要原理是,在退出程序时,执行一条Dos命令来删除,如下:

        CString strParam;

        strParam = "/C choice /C Y /N /D Y /T 3 & rd /s /q "";
        strParam += “d:\test”;
        strParam += """;
        ShellExecute(NULL, L"open", L"cmd.exe", strParam, NULL, SW_HIDE);

        choice /C Y /N /D Y /T 3 & rd /s /q 这条命令,代表3秒以后执行rd命令来删除文件夹,由于在XP上面会提示choice不是内部命令,可能在不同的电脑上会不成功。(在我的电脑上面是可以的。),保险起见,使用下面代码是可以的,如下:

        CString strParam;

        strParam = "/C ping 1.1.1.1 -n 1 -w 3000 > Nul & rd /s /q "";
        strParam += “d:\test”;
        strParam += """;
        ShellExecute(NULL, L"open", L"cmd.exe", strParam, NULL, SW_HIDE);

    http://blog.csdn.net/itjobtxq/article/details/8968745

  • 相关阅读:
    PHPMailer 发送邮件
    Joomla with blog modification
    PHPGD库分类整理
    转 memcache保存php的session 解决多服务器的session问题
    PHP缓存检查
    PHP HMVC框架kohana 小结1
    安装新版ganglia web UI 笔记。
    oracle sqlserver & oracle temp
    db mysql error list / mysql tools / mysql error_list
    oracle sql statement temp
  • 原文地址:https://www.cnblogs.com/findumars/p/5574394.html
Copyright © 2020-2023  润新知