What was in the log files?
The error looks more like an OS style error, you are unable to write or read a certain directory on the OS. This might be because you have a space in your path: d:/APEX app/apex... , the docs say don't do that https://docs.oracle.com/database/apex-18.1/HTMIG/downloading-and-installing-Oracle-AE.htm#HTMIG29342 . It might also be because the OS user you are using doesn't have the right privileges to the appropriate folder.
I suggest unzip the download somewhere else (c:\temp\ is fine), confirm that the directory can be written to (for logs) and then run it from there.
BTW is there any reason you are installing 5.1 rather than 18.1? I have hardly any experience but I upgraded my APEX 5.1 last night to 18.1 and I already feel so much more comfortable using it.
Thanks for your replies, guys! Andrew, it was the space, actually. After renaming the folder, all worked as expected (well, more or less). I needed to unzip the folder to the D:\ drive because i ran out on C:\. Also, I'm using these old versions, because the work environments are on those versions, so i wanted to have a 1:1 sandbox for my learning process.
Again, thank you for your help!