Java & Multiline Batch Files -


i try run batch file in java, file performed not completely. code like:

runtime.getruntime().exec("cmd /c call "+path); 

when try run manually, without java, batch works correct.

batch file contains next code:

cd c:\downloads\ if not exist documents mkdir documents move *.odt documents move *.doc documents if not exist archives mkdir archives move *.tar archives move *.gz archives if not exist music mkdir music move *.mp3 music 

java complete batch fifth line. has faced this?


hm, batch, stoped again here. , java code: link. if add somename.ogg downloads folder, script goes next line. folders (archives, documents etc) exists, , downloads folder doesn't contain *.zip, *.tar, *.docx, *pdf files, these lines passed without problems. why stoped precisely @ ogg-line?

i think problem there bug in batch script. msdn documentation if command states this:

you cannot use if command test directly directory, null (nul) device exist in every directory. result, can test null device determine whether directory exists. following example tests existence of directory:

if exist c:\mydir\nul goto process

now way using (if not exist directory mkdir directory) succeed if directory doesn't exist ... attempt create directory second time if exist. ooops ...


now, java application read , printed out contents of error stream process, you'd see error message telling archives directory existed. ignoring output asking trouble, imo.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -