setWindowsSubsystem method

void setWindowsSubsystem({
  1. required bool gui,
})

Sets/writes the Windows Subsystem to GUI or Console.

Implementation

void setWindowsSubsystem({required bool gui}) {
  var currentSubsystem = readWindowsSubsystem();
  if (currentSubsystem != 2 && currentSubsystem != 3) {
    throw StateError(
        "Current subsistem not compatible with `console/GUI` switch: $currentSubsystem");
  }

  var subsystem = gui ? 2 : 3;
  writeWindowsSubsystem(subsystem);
}