I got a simple code to connect to remote server. For some reason, it keep asking for password even when i already gave it in the code. The password include exclamation mark
The below batch log in to remote desktop using the credentials provided.
Save it as RDPLogin.bat (edit credentials as required)
use ^ for escape characters (for example)
@echo off
::Server Address/IP
set mysrvad=xyz.myrdp.com
::Server User ID
set mysrvid=user
::Server User Password
set mysrvpswd='Aa123456^!'
cmdkey /generic:%mysrvad% /user:%mysrvid% /pass:%mysrvpswd%
cls
mstsc.exe /v:%mysrvad%
exit