Escape exclamation mark in batch file

后端 未结 1 1951
遥遥无期
遥遥无期 2020-12-21 07:39

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

相关标签:
1条回答
  • 2020-12-21 08:23

    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
    
    0 讨论(0)
提交回复
热议问题