Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 CMD COMMANDS
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
eNc




PostPosted: Tue Nov 09, 2004 7:04 pm   Post subject: CMD COMMANDS

Is there a way to open cmd and then execute a cmd command in a java program ?
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Tue Nov 09, 2004 8:05 pm   Post subject: (No subject)

what types of commands are u talkin about? things like shutdown, ipconfig, netsend? or like dir, cd..
wtd




PostPosted: Tue Nov 09, 2004 8:24 pm   Post subject: (No subject)

http://www.mountainstorm.com/publications/javazine.html

Not tested:

code:
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




PostPosted: Wed Nov 10, 2004 8:05 pm   Post subject: (No subject)

dodge_tomahawk wrote:
what types of commands are u talkin about? things like shutdown, ipconfig, netsend? or like dir, cd..


yea mainly shutdown lol
eNc




PostPosted: Wed Nov 10, 2004 8:05 pm   Post subject: (No subject)

praise our programming god wtd
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: