Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2006
    Posts
    3

    Unanswered: How to run CMD Commands with Java

    hi all~~~~~

    i want to run cmd commands using Runtime.getRuntime.exec("some command"), and now, how to fix the command string format????


    e.g.
    Process p = Runtime.getRuntime.exec("cmd /c dir");
    .................
    it will list files and directories under the workspace directory,
    and then how to change the current directory to another directory or exec some other command??????

    thanks............

  2. #2
    Join Date
    Jan 2003
    Posts
    1,605
    Quote Originally Posted by MaoLi
    hi all~~~~~
    how to change the current directory to another directory or exec some other command
    Hi,
    have you tried "cmd /c dir c:\windows"
    for c:\windows directory?

    BTW, this is DB2 forum and this is operating system question... Try using any other forum like http://www.tek-tips.com
    Hope this helps,
    Grofaty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •