有些时候,需要执行命令,又不想去登录到窗口。
1. 假设要登录服务器执行 touch a.txt 后就退出:
ssh root@192.168.1.20 "touch a.txt"
2.如果遇到文件名中有空格,需要双引号的,可以用\转义
ssh root@192.168.1.20 "touch \"a b.txt\""
参考、来源:
https://learn.microsoft.com/zh-cn/windows/terminal/tutorials/ssh
https://learn.microsoft.com/zh-cn/windows/terminal/install#settings-json-file
https://learn.microsoft.com/zh-cn/windows/terminal/command-line-arguments