Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for printppt.bat

(view source code of printppt.bat as plain text)

  1. @ECHO OFF
  2. ECHO.
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4. SETLOCAL
  5. IF      "%~1"=="" GOTO Syntax
  6. IF NOT  "%~2"=="" GOTO Syntax
  7. SET Ext=%~x1
  8. SET Ext=%Ext:~1,3%
  9. IF /I NOT "%Ext%"=="PPT" GOTO Syntax
  10. IF    NOT EXIST "%~1"    GOTO Syntax
  11.  
  12. SET PptProg=
  13. IF EXIST "C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE" (
  14. 	SET PptProg="C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE" /S
  15. 	SET PrgDesc=PowerPoint Viewer 2003
  16. )
  17. IF EXIST "C:\Program Files\Microsoft Office\Office12\PPTVIEW.EXE" (
  18. 	SET PptProg="C:\Program Files\Microsoft Office\Office12\PPTVIEW.EXE" /S
  19. 	SET PrgDesc=PowerPoint Viewer 2007
  20. )
  21. IF EXIST "C:\Program Files\Microsoft Office\Office11\POWERPNT.EXE" (
  22. 	SET PptProg="C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE"
  23. 	SET PrgDesc=PowerPoint 2003
  24. )
  25. IF EXIST "C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE" (
  26. 	SET PptProg="C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE"
  27. 	SET PrgDesc=PowerPoint 2007
  28. )
  29. IF NOT DEFINED PptProg GOTO Syntax
  30.  
  31. ECHO Using Microsoft Office %PrgDesc% to print "%~1"
  32. START "PowerPoint" %PptProg% /P "%~1"
  33. ENDLOCAL
  34. GOTO:EOF
  35.  
  36.  
  37. :Syntax
  38. ECHO PrintPPT.bat,  Version 1.00 for Windows NT 4 and later
  39. ECHO Open a print dialog for the specified PowerPoint file
  40. ECHO.
  41. ECHO Usage:  PRINTPPT  powerpoint_file
  42. ECHO.
  43. ECHO Where:  powerpoint_file is the PowerPoint file to be printed
  44. ECHO.
  45. ECHO Note:   This batch file requires either PowerPoint
  46. ECHO         or PowerPoint Viewer, Version 2003 or 2007
  47. ECHO.
  48. ECHO More info on PowerPoint command line switches:
  49. ECHO http://office.microsoft.com/en-us/powerpoint/HA101538891033.aspx
  50. ECHO http://support.microsoft.com/kb/830040
  51. ECHO.
  52. ECHO Written by Rob van der Woude
  53. ECHO http://www.robvanderwoude.com
  54.  
  55. IF "%OS%"=="Windows_NT" ENDLOCAL
  56. IF "%OS%"=="Windows_NT" EXIT /B 1
  57.  

page last uploaded: 2017-04-06, 13:33