cmd /C set variable -
the short: trying make 1 line command script sets , uses variable. right came with:
cmd /c "set var=127.0.0.1 & echo %var%"
i expect output 127.0.0.1, instead prints %var%.
the long: using keepass password manager , trying make automatically launch rdp session me. put following in url:
cmd://cmd /c "cmdkey /generic:termsrv/127.0.0.1 /user:{username} /pass:{password} & mstsc.exe /v:127.0.0.1 & cmdkey /delete:termsrv/127.0.0.1"
this works, if need update ipaddress, have touch 3 places instead of 1. tried changing following, didn't work:
cmd://cmd /c "set sserver=127.0.0.1 & cmdkey /generic:termsrv/%sserver% /user:{username} /pass:{password} & mstsc.exe /v:%sserver% & cmdkey /delete:termsrv/%sserver%"
josefz comment worked perfectly. following command can placed in "url:" field in keepass. when double click url or else launches url automatically launch rpd , log in.
cmd://cmd /c "for /f "tokens=*" %g in ("127.0.0.1") cmdkey /generic:termsrv/%g /user:{username} /pass:{password} & mstsc.exe /v:%g & cmdkey /delete:termsrv/%g"
i have tested rdping both windows box , linux box.
Comments
Post a Comment