Requirements:
- Must have a default printer selected.
- Must have a default program assigned to file types you are printing
Powershell code:
#Script written by Dane Fieber. Please use this script freely. Enjoy! #Print all files in a folder $useroutput = Read-Host(‘Would you like to view the files being printed? yes/no ‘) $dir = Read-Host(‘Enter the full folder path to print. i.e. C:\Folder\inside folder’) $files = Get-ChildItem $dir foreach ($file in $files){ if ($useroutput -eq ‘yes’) { #Check for the users input on if to display files and pause between files. Start-Process -FilePath $file.fullName -Verb Print Write-Host ‘The current file printing is ‘$file.fullname’…..’ Pause #Added a pause here to slow down the printing process. } else{ #Will print all files without any pause. Start-Process -FilePath $file.fullName -Verb Print } }As you can see the script is very simple and does not require a lot to actually do what you want. I have added a few things to the script to make it more user-friendly.
- Would you like to see the files being printed?
- Yes = Display file name being printed and pause after each file.
- No = Do not display the file name being printed and do not pause after each file.
- What directory would you like to print?
- Enter in the full path to the directory, E:\Test\Testing. This will support UNC paths, \\testshare\foldertoprint
Tech Support from Navisiontech… On-Demand and On Point
Try Navisiontech Support today! We offer 2 FREE hours of support for nearly ALL versions of Dynamics NAV, from version 3 to Business Central. Our support team is US based and will provide support not only for your ERP system, but also for SQL Server, EDI, supply chain management tools, and even code-level support.
Leave A Comment