Many scripts redirect their text or HTML output to a text file, and some scripts even use automation to redirect their output to Microsoft Excel. These approaches are fine if you're reading the output on screen or emailing it to someone, but if you want to print the results, you need to open the file, then choose the Print option. If you typically want to print a particular script's results, you might prefer to have the script print the file. Let's look at the several ways you can print from within your scripts.
Simple Does It
The simplest way to print from a script is to use Notepad's print functionality. When you use the /p switch, Notepad prints the file to your default printer. For example, the following code causes Notepad to print C:\mylog.txt to your default printer:
Notepad /p c:\mylog.txt
Listing 1, page 2, shows a snippet of VBScript code that uses this command. This code should work fine as long as your PATH environmental variable includes the directory that contains Notepad; otherwise, you need to specify Notepad's full path. . . .