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 Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime.getRuntime().exec doesnt execute some files

 
garfild Baram
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi helper,
I use in my code:

Process p = Runtime.getRuntime().exec(scriptToRun);

and it runs file1.cmd that containes the following:

file1.cmd:

set ADVANTAG_FOLDER=c:\Yoss_test
RD /s /q %ADVANTAG_FOLDER%


but it doesnt run file2.cmd :-(

file2.cmd:

echo "after File " >> after.txt


Do you have a clue why file1 is executed and file2 is not. I dont get any errors at all.

Thanks
Yossi
 
garfild Baram
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for the trubles....

All files are executed ,I just looked for the results in the wrong place.

All good

Thanks

Yossi
 
Henry Wong
author
Marshal
Pie
Posts: 20817
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure it is not running? Or are you just having problems finding the "after.txt" file?

I would suggest that either you use the version of exec() that sets the working directory, or scan your disk to see where this file is.

Henry
 
Henry Wong
author
Marshal
Pie
Posts: 20817
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to see that you solved it on your own...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic