title: Going into a directory from Windows command prompt via Java
body: <p>Having a little bit of trouble with getting some commands to run in Windows command prompt via Java. I am looking to go into my system32 folder and run a certain file however it does not populate the command. Segment of the code below:</p>
  
  <pre><code>System.out.print("Press 1 for Normal or 2 for Keygen - " + client);
          String mode = input.nextLine().trim();
          if (mode.equals("1")) {
              String command = "cmd /c start cmd.exe";
               final String dosCommand = "cmd /c dir /s";
                  final String location = "C:\\WINDOWS\\system32"; 
              Process child = Runtime.getRuntime().exec(command);
               OutputStream out = child.getOutputStream();
                  out.write(dosCommand.getBytes());
                  out.flush();
                  out.write(location.getBytes());
                  out.close();
          } else if (mode.equals("2")) {
  
          } else {
              System.out.println("Option not recognised");
          }
  </code></pre>