like this then?

Code:
SHELL '%COMSPEC% /e:1024 /c dir /b /ad /o-n "%ProgramFiles%\Java\" >> c:\JavaDirectory.txt
? @error + ": " @serror
get $
$ = OPEN (1, "c:\JavaDirectory.txt")
$BeforeJavaVersion = ReadLine(1)
$ = CLOSE (1)



??