//-------------------------------------------------------------------------
    // Execute the command typed in the command textbox
    static bool ExecuteCommand()
    {
        LPCTSTR CmdFileName = GenerateTempBatchFileName();
        DeleteFile(CmdFileName);

        // Write temp file
        FILE *fp;
        if (_tfopen_s(&fp, CmdFileName, _TEXT("w")) != 0)
        {
            MessageBox(hDlg, TEXT("Failed to write batch file"), TEXT("Error"), MB_OK | MB_ICONERROR);
            return false;
        }

        stringT Cmd;
        if (!GetCommandWindowText(Cmd))
        {
            MessageBox(hDlg, TEXT("Failed to get command text"), TEXT("Error"), MB_OK | MB_ICONERROR);
            return false;
        }

        _ftprintf(fp, _TEXT("%s\n"), Cmd.c_str());
        fclose(fp);

        // Execute the temp batch file
        return SUCCEEDED(
            ShellExecute(
            hDlg,
            _TEXT("open"),
            CmdFileName,
            NULL,
            NULL,
            SW_SHOW));
    }
//-------------------------------------------------------------------------
// Execute the command typed in the command textbox
bool ResetPermissionDialog::ExecuteWindowCommand(bool bValidateFolder)
{
    // Warn if this is a root folder
    if (bValidateFolder)
    {
        stringT Path;
        if (!GetFolderText(Path, true, false, false))
            return false;
    }

    // Get the window command
    stringT Cmd;
    if (!GetCommandWindowText(Cmd))
    {
        MessageBox(
            hDlg,
            TEXT("Failed to get command text"),
            TEXT("Error"),
            MB_OK | MB_ICONERROR);
        return false;
    }

    // Execute the command
    if (!ExecuteCommand(Cmd))
    {
        MessageBox(
            hDlg,
            TEXT("Failed to execute get command text"),
            TEXT("Error"),
            MB_OK | MB_ICONERROR);
        return false;
    }
    return true;
}