This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime.getRuntime().exec doesnt execute some files

 
garfild Baram
Ranch Hand
Posts: 60
  • 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
  • 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: 20897
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 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: 20897
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to see that you solved it on your own...
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic