如何使用shell脚本打开pptx文件

时间:2014-08-22 09:25:10

标签: shell powerpoint powershell-v3.0

我正在尝试使用shell脚本打开pptx文件。我试过以下命令     catpptcatdoc。它不起作用。

还有其他命令吗?

2 个答案:

答案 0 :(得分:0)

如果文件扩展名.pptx与正确的程序相关联(PowerPoint,我假设),您可以在Powershell中使用Invoke-Item cmdlet。

例如:

Invoke-Item -Path C:\Path\To\MyFile.pptx

Invoke-Item会自动使用相应的程序打开文件,具体取决于在“默认程序”控制面板中配置文件关联的方式。

答案 1 :(得分:0)

如果您有多个程序可以打开.pptx文件或者没有将PowerPoint注册为.pptx文件类型的默认处理程序,则可以这样做。

$pptx = "{path to file}"

$application = New-Object -ComObject powerpoint.application

$presentation = $application.Presentations.open($pptx)

$application.visible = "msoTrue"

$presentation.SlideShowSettings.Run()

相关问题