Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Open cmd.exe to run another program  RSS feed

 
s oc
Greenhorn
Posts: 5
  • 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
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest that worked fine, you're a star
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!