Processing project started in CMD - error handling

I could think of three options:

  1. The corresponding log file is saved in your user folder, there starts usually a new instance of cmd
  2. The log file is saved in %windir%\System32 because there is cmd.exe located
  3. Whyever piping doesn’t work with parameter /k, an approach to save the log file directly in the application:
PrintWriter o;

void setup() {
  o = createWriter("C:/Users/yoursuperhotusername/Desktop/loader/error-check.log");
  try {
     // Whatever your code in setup is
  }
  catch (Exception err) {
    o.println(err);
    o.flush();
    o.close();
    exit();
  }
}

void draw() {
  try {
     // Whatever your code in draw is
  }
  catch (Exception err) {
    o.println(err);
    o.flush();
    o.close();
    exit();
  }
}

(Sorry, forgot the semicolon before because working in Python)

EDIT: Your little bat script should add before executing the program:

mkdir C:\superhotsuperhot\Desktop\loader