
-----------------------------------
eNc
Tue Nov 09, 2004 7:04 pm

CMD COMMANDS
-----------------------------------
Is there a way to open cmd and then execute a cmd command in a java program ?

-----------------------------------
Andy
Tue Nov 09, 2004 8:05 pm


-----------------------------------
what types of commands are u talkin about? things like shutdown, ipconfig, netsend? or like dir, cd..

-----------------------------------
wtd
Tue Nov 09, 2004 8:24 pm


-----------------------------------
http://www.mountainstorm.com/publications/javazine.html

Not tested:

import java.lang.*;
import java.io.*;

public class DirDemo
{
   public static void main(String[] args)
   {
      Process dir = Runtime.getRuntime().exec("dir");
      BufferedReader dirOut = new BufferedReader(
         new InputStreamReader(dir.getInputStream()));

      while (String line = dirOut.readLine() != null)
      {
         System.out.println(line);
      }
   }
}

-----------------------------------
eNc
Wed Nov 10, 2004 8:05 pm


-----------------------------------
what types of commands are u talkin about? things like shutdown, ipconfig, netsend? or like dir, cd..

yea mainly shutdown lol

-----------------------------------
eNc
Wed Nov 10, 2004 8:05 pm


-----------------------------------
praise our programming god wtd
