title: Why is my code to enter input to a batch file not working?
body: <p>I'm trying to write to a loaded batch file process, but I cannot figure out how to do the equivalent of a return.</p>
  
  <p>Java Code:</p>
  
  <pre><code>import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import java.util.Scanner;
  
  public class Start {
      public static void main(String[] args) {
          try {
              Process p = Runtime.getRuntime().exec("C:\\Users\\Max\\Desktop\\test.bat");// Runtime.getRuntime().exec("keytool -genkey -alias " + name.replace(" ", "").trim() + "  -keystore key");
              DataInputStream in = new DataInputStream(p.getInputStream());
              Scanner scanner = new Scanner(in);
              // System.out.println(scanner.nextLine());
              DataOutputStream out = new DataOutputStream(p.getOutputStream());
              out.write("test\n\n".getBytes());
              out.flush();
              out.close();
          }catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Batch code:</p>
  
  <pre><code>@echo off
  set /p delBuild=lozors?: 
  echo test &gt;&gt; test.txt
  </code></pre>
  
  <p>When run, it should output to a text file on my desktop... but it doesn't seem to take the input? I've tried using \n and \n\n, as well as just writing and flushing, but it doesn't work. Ideas?</p>