【问题标题】:Convert Multiple PowerPoint Files to PDF using CMD [closed]使用 CMD 将多个 PowerPoint 文件转换为 PDF [关闭]
【发布时间】:2017-07-27 10:30:53
【问题描述】:

有什么方法可以使用 Windows 命令行将文件夹中的多个 PowerPoint 文件转换为 PDF?

【问题讨论】:

    标签: batch-file command-line cmd


    【解决方案1】:

    这不是故障安全(您可以添加文件存在检查等)。将此另存为.bat

    @if (@X)==(@Y) @end /* JScript comment
        @echo off
    
        cscript //E:JScript //nologo "%~f0" %*
    
        exit /b %errorlevel%
    
    @if (@X)==(@Y) @end JScript comment */
    
    var source=WScript.Arguments.Item(0);
    var target=WScript.Arguments.Item(1);
    PP = new ActiveXObject("PowerPoint.Application");
    PRSNT = PP.presentations.Open(source,0,0,0)
    //PRSNT.SaveCopyAs(target,32);
    //https://msdn.microsoft.com/en-us/vba/powerpoint-vba/articles/ppsaveasfiletype-enumeration-powerpoint
    PRSNT.SaveAs(target,32);
    PRSNT.Close();
    PP.Quit();
    

    第一个参数是 powerpoint 文件,第二个参数是要保存它的新文件。有关presentation object的更多信息

    下一步是处理文件(如果之前的脚本保存为ppt2pdf.bat):

    @echo off
    ::change the locataion in the line bellow
    set "ppt_dir=c:\ppts"
    for %%a in ("%ppt_dir%\*pptx" "%ppt_dir%\*ppt") do (
      call ppt2pdf.bat "%%~fa" "%%~dpna.pdf"
    )
    

    【讨论】:

    • 不错的解决方案!是否可以设置输出路径?
    • @Andrea_86 - 你可以。在第二个脚本开头的某处使用set "output_dir=c:\output",然后使用call ppt2pdf.bat "%%~fa" "%output_dir%\%%~nxa.pdf"
    • 太棒了,就像魅力一样。
    猜你喜欢
    • 2011-01-31
    • 1970-01-01
    • 2016-12-19
    • 2010-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多