Well, I think this is mainly a syntax problem, but I just can't figure out how to get this thing to do what I want it to.

I have a program that needs to run with an open command prompt window so that when the user closes the window the program goes away. To do that, I created this short program (it's one line of code; it's more like a script than a program) to access cmd.exe and do it so that I could have an executable JARfile to make running the program simple for the end user (rather than them having to type at the command prompt).

Here is my code. If I run it, it seems like it only gets as far as the cd C:\HearingAid bit, completely ignoring the fact that it goes FURTHER into the ProgramData folder, and of course not even coming within a mile of making a call to Java.exe:

import java.io.IOException;
 
public class HearingAid {
 
public static void main(String[] args) throws IOException {
 
Runtime.getRuntime().exec(new String[] { "cmd.exe", "/C", "start;", "cd C:/HearingAid/ProgramData", "&", "java AudioTransfer"});
 
	}
}

What have I written wrong, folks?

-summit45

--- Update ---

I feel kind of stupid now, but I just saw someone on StackOverflow suggest to someone else for a very slightly similar issue to just use a shell script for this. The irony is I was using those earlier to simplify compiling and didn't think of that. Lol.

Either way, someone feel free to answer the question if you want to. Can always learn something.

-summit45