Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for printhtm.bat

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

  1. @ECHO OFF
  2. SETLOCAL
  3.  
  4. :: Command line parsing
  5. SET File2Print=%*
  6. ECHO.%File2Print% | FIND "?" >NUL
  7. IF NOT ERRORLEVEL 1 GOTO Syntax
  8. :: Strip leading space in NT 4 only
  9. VER | FIND "Windows NT" >NUL
  10. IF NOT ERRORLEVEL 1 IF DEFINED File2Print SET File2Print=%File2Print:~1%
  11. IF DEFINED File2Print SET File2Print=%File2Print:"=%
  12. IF NOT DEFINED File2Print GOTO Syntax
  13. IF NOT EXIST "%File2Print:"=%" GOTO Syntax
  14.  
  15. :: Actual print command
  16. RUNDLL32.EXE MSHTML.DLL,PrintHTML "%File2Print%"
  17.  
  18. :: Done
  19. GOTO End
  20.  
  21. :Syntax
  22. ECHO.
  23. ECHO PrintHTM.bat,  Version 1.11 for Windows NT
  24. ECHO Prints a local HTML file from the command line
  25. ECHO.
  26. ECHO Written by Rob van der Woude
  27. ECHO http://www.robvanderwoude.com
  28. ECHO.
  29. ECHO Usage:  %~n0  ^<html_file^>
  30.  
  31. :End
  32. ENDLOCAL
  33.  

page last uploaded: 2017-07-06, 12:37