有没有办法从终端启动屏幕共享?

有没有办法从终端启动屏幕共享?

如何从命令行启动 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

相关内容