title: How to start a program using cmd in windows
body: <p>What i need is to accept a path (via args) to a mongod.cfg file and use it to start mongod from java. This is whar i am using</p>
  
  <pre><code>Runtime.getRuntime().exec("cmd /k start mongod --config C:\\Users\\Ivan\\git\\StudentsDBMS_Server\\StudentsDBMS_Server\\mongod.bat");
  </code></pre>
  
  <p>And this is what i get
  <a href="https://i.stack.imgur.com/7fu4i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7fu4i.png" alt="enter image description here"></a></p>
  
  <p>On removing <strong>start</strong> command it does not runs the command.
  Also can you explain why does it prints the command infinitely but does not execute anyone of them.</p>
  
  <p>Please</p>