如何从命令行启动Mac OS X应用程序? [英] How to startup a Mac OS X application from command line?

查看:87
本文介绍了如何从命令行启动Mac OS X应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"open -a"不是想要的答案,因为我想自动调试Mac OS X应用程序.这意味着如果有人可以提供类似 [program] [args] 格式的命令行会更好.因此,ltrace机制可以将 [程序] 作为调试的目标,并以 [args] 作为输入.

我尝试过类似"/Applications/Microsoft Office 2011/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint"/Users/poc.pptx的命令行,仅启动了Microsoft Point进程,但未打开poc.pptx./p>

用打开的pptx文件对Microsoft Point进行grep处理后,它类似于:/Applications/Microsoft Office 2011/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint -psn_0_307275,没有参数"poc.pptx".>

我什至手动使用"gdb/Applications/Microsoft Office 2011/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint"和"set args/Users/poc.pptx",然后使用"r",目标应用程序可以不能在打开某些文件的情况下运行.

我对此感到困惑,所以,有人可以帮助我解决这个问题吗?

谢谢!

解决方案

转到文件目录,然后键入

  open -a"Microsoft PowerPoint"< filename.ppt> 

这里的Microsoft PowerPoint"是电源点应用程序的名称,如果您的应用程序目录中的电源点名称不同,请检查电源点名称.

这在我的MAC(OSX 10.8)上运行正常.

我们还可以提供完整的路径,而不仅仅是文件名.

 打开-"Microsoft PowerPoint"< ppt文件路径> 

这也很好.

"open -a" is not the answer wanted, because I want to debug the Mac OS X application automatically. This means it's better if someone can give the command line like [program] [args] format. So ltrace mechanism can make [program] as target for debugging and take [args] as input.

I have tried command line like "/Applications/Microsoft Office 2011/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint" /Users/poc.pptx, only Microsoft Point process started but the poc.pptx not opened.

After grepping the Microsoft Point with pptx file opened, it's something like: /Applications/Microsoft Office 2011/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint -psn_0_307275, there is no argument "poc.pptx".

I even manually use "gdb /Applications/Microsoft Office 2011/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint" and "set args /Users/poc.pptx", and then "r", the target application can not run with the certain file opened.

I am confused about this, so, is there someone can help me to solve this problem?

Thank you!

解决方案

Go to file directory and then type

open -a "Microsoft PowerPoint" <filename.ppt>

Here "Microsoft PowerPoint" is the name of power point application, please check name of power point if it is different in your application directory.

This is working perfectly fine on my MAC (OSX 10.8).

We can also give complete path instead of just file name.

    open -a "Microsoft PowerPoint" <ppt file path>

This is also working fine.

这篇关于如何从命令行启动Mac OS X应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆