• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Runtime.getRuntime().exec doesnt execute some files

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to see that you solved it on your own...
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic