Some applications (including Notepad) support a printto
command. Notepad's is /pt printername
. You'll probably have to experiment some to get the printer name just right - I believe it's the name of the printer as seen in Control Panel, but it may be the name of the device or driver itself. (A few quick tests should help you figure out which applies.)
Shell("NOTEPAD /PT MyLaserJet C:\Temp\test.txt")
Of course, the proper solution to this problem is to change your application so it doesn't use Shell("notepad",...)
to do the printing, but actually sends the text to the printer itself. You can then have the user set up the printer once, save that configuration, and then automatically send the text to the proper printer every time. Using an external application to do the work your app should do itself is a workaround, not a solution. :-) I can't suggest how you would do that, because you've provided no information about your application. There are lots of questions here related to printing for almost every language and platform, though - you can probably find one that will get you started with a little searching.