c - 使用c程序清空回收站

标签 c command-prompt recycle-bin

我无法使用c 程序清空回收站,它给出了“未指定文件路径”错误。 当我通过 command in the command prompt 时它工作得很好但在c程序中则不然。 甚至尝试在管理员模式下运行 Visual Studio。

int BinFiles()
{   
char folderCommand[]= "rd /s %systemdrive%\$Recycle.bin";
system(folderCommand);
return 0;
}

最佳答案

您需要转义 \ 字符:

int BinFiles()
{   
    char folderCommand[]= "rd /s %systemdrive%\\$Recycle.bin";
    system(folderCommand);
    return 0;
}

关于c - 使用c程序清空回收站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28318658/

相关文章:

c - 将子线程拆分为新的子线程 (Openmp)

windows - 如何在 PowerShell 中键入 TAB 字符?

windows - 配置 https 非常简单 - 使用 openssl

c++ - 从 C++ 读取垃圾文件

c - 为什么变量 i 在循环中没有递增?

c - Malloc 内存问题

windows - 为每个脚本实例创建文件

ios - “tmp”目录在 iOS 中太大

wordpress - 在前端访问已删除的 WordPress 帖子

c - 将随机数存储在二维数组中