File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open cmd.exe to run another program

 
s oc
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm having problems trying to open the command prompt even when i use the full path but don't have any problems opening other files like mspaint or notepad. Here is the code I am using:

Runtime.getRuntime().exec("cmd.exe");

Also, I need to run another program through the command prompt called foremost.exe which has to be run through the command prompt. When it is executed on the command prompt it should look like this:
c:\foremost [imageFileName.dd]

Any ideas would be much appreciated

shinny
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

You'd want to do something like

Runtime.getRuntime().exec("cmd.exe /c formost imageFileName.dd");
 
s oc
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest that worked fine, you're a star
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic