我系统里的plink.exe是VMware自带的
C:\Program Files (x86)\VMware\VMware vCenter Converter Standalone\plink.exe
语法:plink.exe -ssh -P your_port -pw “password” username@your_host
cmd、powershell通用,ssh可执行命令,在新窗口
首次执行会存在y/n的交互
cd "C:\Program Files (x86)\VMware\VMware vCenter Converter Standalone"
cmd.exe /c start /wait plink.exe -ssh -P 36000 -pw "密码" Administrator@81.70.149.112
cmd、powershell通用,ssh可执行命令,在新窗口
y/n交互相当于通过echo “空格”敲了y,你可以试试echo.相当于直接回车(y/n的交互,直接回车相当于敲了n)
cd "C:\Program Files (x86)\VMware\VMware vCenter Converter Standalone"
echo " "|cmd.exe /c start /wait plink.exe -ssh -P 36000 -pw "密码" Administrator@81.70.149.112
cmd、powershell通用,仅验证登录,不可执行命令,在新窗口
cd "C:\Program Files (x86)\VMware\VMware vCenter Converter Standalone"
powershell -command "& {Start-Process cmd.exe -ArgumentList {/c start /wait cmd /c echo |plink.exe -ssh -P 36000 -pw "密码" Administrator@81.70.149.112}}"
用plink批量验证ssh免交互登录非常方便。
文章来源:https://www.cnaaa.net,转载请注明出处:https://www.cnaaa.net/archives/11866