private static int runCMD(String[] args) {
		int result = RESULT_SUCCESS;
		System.out.println("MMBN Randomizer " + Main.VERSION);
		System.out.println("By Prof. 9");
		System.out.println("https://github.com/prof9/mmbn-randomizer/");
		System.out.println();

		// Get input path.
		if (args.length <= 0) {
			System.err.println("ERROR: Input path not specified.");
			return RESULT_ERROR;
		}
		String inPath = args[0];

		// Get seed.
		int seed = new Random().nextInt();
		if (args.length > 2) {
			seed = toSeed(args[2]);
		}

		// Get output path.
		String outPath;
		if (args.length > 1) {
			outPath = args[1];
		} else {
			outPath = String.format("Randomized-%08X.gba", seed);
		}

		// Load input ROM.
		ByteStream rom;
		try {
			rom = readFile(inPath);
		} catch (IOException ex) {
			System.err.println("ERROR: Could not read input ROM.");
			return RESULT_ERROR;
		}

		// Get randomizer context.
		RandomizerContext context = ContextSelector.getAppropriateContext(rom);
		if (context == null) {
			System.err.println("ERROR: Unsupported ROM ID.");
			return RESULT_ERROR;
		}

		// Run randomizer.
		System.out.println("Starting...");
		context.setSeed(seed);
		context.addObserver(new Observer() {
			@Override
			public void update(Observable o, Object arg) {
				System.out.println((String) arg);
			}
		});
		context.randomize(rom);

		// Write output ROM.
		try {
			writeFile(outPath, rom);
		} catch (IOException ex) {
			System.err.println("ERROR: Could not write output ROM.");
			return RESULT_ERROR;
		}

		System.out.println("Done!");
		return result;
	}