It's quite perplexing indeed. I can't see anything wrong except for the fact that you are using cmd variable syntax %APPVEYOR_BUILD_FOLDER% for powershell (should use $env:APPVEYOR_BUILD_FOLDER) but that doesn't seem to be the problem here.
Can you try to remove all but the first few commands and run a build.
Also, if this is blocking you, I'm guessing that checking in an appveyor.yml file with the above config in it would not run into this error. Though, of course, we'd still like to find out why this error is occurring.
Removing all the script would successfully build and I think adding them into an appveyor.yml file would also work but I am trying to avoid adding a yml because I need to push to git everytime I want to try something in the build process.