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.