It makes no practical sense. Two things: 1) ping is ping, it can be done on any computer, either the host of RDP client or server; so there is no need to "ping remotely"; 2) there is no need to run any batch file to ping.
Let's see. You can ping any computer system running the service supporting the
ICMP protocol. That means nearly all non-nonsense systems participating in networking. Please see:
http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol[
^],
http://en.wikipedia.org/wiki/Ping_%28networking_utility%29[
^].
You did not explain what system did you try to ping, the host of your RDP service, client, or some other one, so your logic is hard to understand. I can say one thing: whatever it is, this logic would like quite weird to me. Perhaps you can explain. No matter; this is how you can ping any system from anywhere:
https://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping%28v=vs.110%29.aspx[
^].
This way, you don't need to crack unnatural riddles. :-)
As the active part is, as always, the client part, most likely you need to add the ping functionality on the client, which is, by the way, easier to do, because you can always implement custom RDP client, which is simple enough. You can review some existing implementations, such as those two from CodeProject:
Palantir - Remote Desktop Manager[
^] (my favorite),
Remote Desktop using C#.NET[
^].
—SA