

The following code shows how to read the contents of a preformatted file into memory, and then send those bytes to the printer by using WritePrinter. The pipe operator (|) takes the output of one command and directs it into the input of another command which in our case is clip. To send these types and other types of raw data to a printer, your code must work with Win32 Spooler Application Programmer Interfaces (APIs).
#Vb6 print to file clipboard windows
The “clip” command may not be available on Windows XP but in that case, you can use the redirect operators, like > and >, for saving the command output to a text file.Īlternatively, right-click anywhere inside the command window, select Mark from the contextual menu, use the mouse to highlight a block text and then press Enter to save it to the clipboard.

Id like to be able to do this from code from within a VB program. That command copies the file with the binary switch 'on' so that the file is sent to the printer unaltered.

If you need to print the contents of a directory in Windows, the command “dir” will come to your rescue.Ĭopy command line output to Windows Clipboard Like it or not, the command prompt is still an indispensable part of your Windows computer because there are still a bunch of things that can only be done by writing commands.įor instance, if the computer isn’t connecting to the Internet, you will probably be interested in the output of the “ping” or the “tracert” command.
