Closing popup console window by pressing [x] instead of "press any key" preventing "del %0". This:
str = g_strdup_printf("cd "%s"\n\n%s\n\n%s\ndel "%%0"\n\npause\n", working_dir, expanded_cmd, (autoclose) ? "" : "pause");
generate "pause" before "del %0" and "pause" after "del".
fix: **str = g_strdup_printf("cd "%s"\n\n%s\n\ndel "%%0"\n\n%s\n", working_dir, expanded_cmd, (autoclose) ? "" : "pause");**