3

Automatically print word document using bat file

"C:\Program Files\Microsoft Office\Office14\winword.exe" "D:/new/CABSC.docx" /mFilePrintDefault /mfileexit

using this bat file I am able to print one word document automatically.

But I have more than 100 word document with different name. Is that possible to call them here to print all the word document using this bat file.

1
  • Yes. Hint: look into forfiles, then try things, and then come back with specific questions about specific problems you run into. As-is you've shown little to no research effort on writing your batch file, so you may get down-votes. Nov 3, 2015 at 22:58

2 Answers 2

2
@echo off
setlocal
set "winword=C:\Program Files\Microsoft Office\Office14\winword.exe"
for /f "delims=" %%a in ('
  dir /b /s "c:\path\docs\*.docx"
') do (
  "%winword%" "%%~a" /mFilePrintDefault /mfileexit
)

Used SET VARIABLE, wildcards inside DIR inside FOR.

0
2

I found a VBS script that prints all documents in the folder it's executed in:

set shApp = CreateObject("shell.application")
currentPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".") 
set shFolder = shApp.NameSpace( currentPath )
set files = shFolder.Items()
for each files in files

    if files.name <> "Imprimir.Expediente" then
        'msgbox("printing "&files.name) 
                                files.InvokeVerbEx ("Print") 

    end if
next

Maybe this could do it for you.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .