I have had to remotely restart systems before and what i do is open a dos shell window and a persistent ping to the IP of the unit that is going to be rebooted. I then can watch as the instructions I passed through another command shell rebooted the computer and it came back online. The systems that were rebooted also had RDP enabled so I could remote into them once they were rebooted to check on services etc.
In batch I believe you can have a loop that pings the IP until the connection comes back and then it steps to the next process in which it is logging you back on, but someone else with more batch knowledge would have to show you how to code this up if your looking for the code and not just how to go about doing this.
I use to use AlertPingPro and it allowed me to add IF conditions, so if the connection was live run a C++ program I wrote and do one thing, or if the connection was down execute another C++ exe that i created to notify me that the connection was down in which i made a system that would call me when equipment failed as well as I had prerecorded voice messages that would play based on the error condition so that I knew exactly what the problem was in my voice telling myself over the phone.