![有没有办法从终端启动屏幕共享?](https://linux22.com/image/1258074/%E6%9C%89%E6%B2%A1%E6%9C%89%E5%8A%9E%E6%B3%95%E4%BB%8E%E7%BB%88%E7%AB%AF%E5%90%AF%E5%8A%A8%E5%B1%8F%E5%B9%95%E5%85%B1%E4%BA%AB%EF%BC%9F.png)
如何从命令行启动 OS X 的屏幕共享并让它连接到指定的系统?
答案1
open vnc://server.address[:port]
答案2
如果您可以在“系统偏好设置”中激活辅助设备的访问权限,则可以尝试在 AppleScript 编辑器中保存以下 AppleScript 并通过命令行执行它:
tell application "Screen Sharing"
activate # start Screen Sharing if not running yet
tell application "System Events"
keystroke "a" using command down # this will cause the address to clear
keystroke "127.0.0.1" # replace with your host
key code 36 # press enter
end tell
end tell
另存为Sharing.scpt
,并作为执行osascript /path/to/Sharing.scpt
。