Launch an app on OS X with command line

前端 未结 12 1050
北恋
北恋 2020-12-04 06:03

I want to launch an app on OSX from a script. I need pass it command line arguments. Unfortunately, open doesn\'t accept command line args.

The only opt

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 06:41

    open also has an -a flag, that you can use to open up an app from within the Applications folder by it's name (or by bundle identifier with -b flag). You can combine this with the --args option to achieve the result you want:

    open -a APP_NAME --args ARGS
    

    To open up a video in VLC player that should scale with a factor 2x and loop you would for example exectute:

    open -a VLC --args -L --fullscreen
    

    Note that I could not get the output of the commands to the terminal. (although I didn't try anything to resolve that)

提交回复
热议问题