Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch print HTML files

Status
Not open for further replies.

MortH

Technical User
Sep 25, 2008
1
US
can anyone show me how to contain the dos command:

rundll32 mshtml.dll,PrintHTML "drive:\path\filename.html"

within a dos FOR loop, so as I can print all the html files in a folder with one mouse click?

the goal here is to make a bat file that sends all the html files in folder to the printer, and then
copies them to a network drive.
 
The basic synbatx for the for loop is as follows:

Code:
FOR /switch %variable IN (set) DO command [command-parameters]

So what you would want is something like:

Code:
FOR /F %%i IN ('dir /b *.html') DO rundll32 mshtml.dll,PrintHTML %%i

This would run a dir command on the current folder, and use each returned line and perform the defined operation after the DO operator. In your case the Printing command.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
To add the copying (not move) function, you might to something like:
Code:
set origin="some path"
set dest="some other path"

for /F %%i in ('dir %origin%\*.html /b /a:-d') DO (
rundll32 mshtml.dll,PrintHTML %origin%\%%i
copy %origin%\%%i %dest%
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top