If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
scheduled printing of a text file using batch files
I've been attempting to automate the process of printing a text file using a batch file or schtasks in the command line, in order to provide a "warm up" method (test page) for our networked Xerox printer. The printer has issues with time outs, after 240 minutes of non use. It then takes 30 seconds to 5 minutes (depending upon the settings in place) for the printer to warm up, before it will print. I can obviously use the software or hardware process to do such, but I have better things to do with my time. Printing from the command line using notepad works fine! (Code String Example notepad /p desktop\blank.txt I am stumped on using the proper syntax method for the command line when attempting to use the "schtasks" for automating this process. (Code String EXAMPLE schtasks /create /s /tn "Printer Warm Up" /tr notepad /p desktop\blank.txt /sc daily /st 10:00:00 /ed 06/06/2008 I receive the following error: ERROR: Invalid syntax. Value expected for '/s' I've tried many different ways of moving the "/s" around to make this work, but it always complains about the string in place. Other ERROR: Cannot specify password without specifying the user name. There should be an easier way to specify the local system, without user name and password? ANY IDEAS? (Besides dumping the Xerox printer...LOL) -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
Ads |
#2
|
|||
|
|||
scheduled printing of a text file using batch files
this would be a scheduled task question rather than a printing question. I
have never used the schtasks command. Unsure which newsgroup that would go to. -- Alan Morris Windows Printing Team Search the Microsoft Knowledge Base he http://support.microsoft.com/search/?adv=1 This posting is provided "AS IS" with no warranties, and confers no rights. "Gadgetman" wrote in message ... I've been attempting to automate the process of printing a text file using a batch file or schtasks in the command line, in order to provide a "warm up" method (test page) for our networked Xerox printer. The printer has issues with time outs, after 240 minutes of non use. It then takes 30 seconds to 5 minutes (depending upon the settings in place) for the printer to warm up, before it will print. I can obviously use the software or hardware process to do such, but I have better things to do with my time. Printing from the command line using notepad works fine! (Code String Example notepad /p desktop\blank.txt I am stumped on using the proper syntax method for the command line when attempting to use the "schtasks" for automating this process. (Code String EXAMPLE schtasks /create /s /tn "Printer Warm Up" /tr notepad /p desktop\blank.txt /sc daily /st 10:00:00 /ed 06/06/2008 I receive the following error: ERROR: Invalid syntax. Value expected for '/s' I've tried many different ways of moving the "/s" around to make this work, but it always complains about the string in place. Other ERROR: Cannot specify password without specifying the user name. There should be an easier way to specify the local system, without user name and password? ANY IDEAS? (Besides dumping the Xerox printer...LOL) -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#3
|
|||
|
|||
scheduled printing of a text file using batch files
Well, I'm no scheduled task expert, either, however, in looking at the
syntax for the schtasks command and the /S switch in particular, I read it that, if you use this switch, you must provide a remote system argument for it; your example has no remote system argument defined. If you leave the /S out, help indicates the system parameter defaults to the local system. The /P switch would probably require a /U username if used. It looks like using /RP SYSTEM would run everything under the system account. If I get some time, I'll play with this. Hal -- Hal Hostetler, CPBE -- Senior Engineer/MIS -- MS MVP-Print/Imaging -- WA7BGX http://www.kvoa.com -- "When News breaks, we fix it!" KVOA Television, Tucson, AZ. NBC Channel 4 Live at Hot Licks - www.badnewsbluesband.com "Gadgetman" wrote in message ... I've been attempting to automate the process of printing a text file using a batch file or schtasks in the command line, in order to provide a "warm up" method (test page) for our networked Xerox printer. The printer has issues with time outs, after 240 minutes of non use. It then takes 30 seconds to 5 minutes (depending upon the settings in place) for the printer to warm up, before it will print. I can obviously use the software or hardware process to do such, but I have better things to do with my time. Printing from the command line using notepad works fine! (Code String Example notepad /p desktop\blank.txt I am stumped on using the proper syntax method for the command line when attempting to use the "schtasks" for automating this process. (Code String EXAMPLE schtasks /create /s /tn "Printer Warm Up" /tr notepad /p desktop\blank.txt /sc daily /st 10:00:00 /ed 06/06/2008 I receive the following error: ERROR: Invalid syntax. Value expected for '/s' I've tried many different ways of moving the "/s" around to make this work, but it always complains about the string in place. Other ERROR: Cannot specify password without specifying the user name. There should be an easier way to specify the local system, without user name and password? ANY IDEAS? (Besides dumping the Xerox printer...LOL) -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#4
|
|||
|
|||
scheduled printing of a text file using batch files
I get the /p to work for me - have a ssimilar problem with a Sharp
printer. However, does anyone know how to use the /p in addition with a specified printer - I have 12 printer to wake up every morning I have tried notepad.exe /p [printername] goodmorning.txt with no result. |
#5
|
|||
|
|||
scheduled printing of a text file using batch files
|
#6
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
(Code String Example notepad /p desktop\blank.txt In the above example, you should be able to print without specifying anything else. (System, Printer, Username and Password shouldn't be required.) However, if you use "SCHTASKS" the "/P" takes on a whole new meaning. ("/P" would then indicate PASSWORD, and using "/P" switch would probably require a /U username if used.) -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#7
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Klaus Jorgensen;3792031 Wrote: wrote: I get the /p to work for me - have a ssimilar problem with a Sharp printer. However, does anyone know how to use the /p in addition with a specified printer - I have 12 printer to wake up every morning I have tried notepad.exe /p [printername] goodmorning.txt with no result. If the printers are all non-GDI (e.g. PCL or PS), you can use the lpr command to print directly to the printer via its ip address: lpr -S ip_address -P lpt1 wakeup.txt The wakeup.txt file could be created by printing to a file from e.g. notepad. /klaus "lpr -S ip_address -P lpt1 wakeup.txt" This works Great Also, and appears to be yet another way to print from the command line. (Thanks for providing another way to do such, I'm always learning! Appreciate your input!) It's very similar to the original command used: notepad /p desktop\blank.txt (Which works fine if I manually type in the command) Does anyone know how to apply this using "SCHTASKS" ? Or possibly open my eyes to using a Batch File for the commands to run at specific times? I really appreciate all suggestions and efforts! Thanks Again! -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#8
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Gadgetman wrote:
"lpr -S ip_address -P lpt1 wakeup.txt" It's very similar to the original command used: notepad /p desktop\blank.txt Yes, but that would require a printer driver - the lpr command sends a raw file to the printer. Does anyone know how to apply this using "SCHTASKS" ? Why not use the GUI to add the batch job? /klaus |
#9
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Gadgetman;3794541 Wrote: "lpr -S ip_address -P lpt1 wakeup.txt" This works Great Also, and appears to be yet another way to print from the command line. (Thanks for providing another way to do such, I'm always learning! Appreciate your input!) It's very similar to the original command used: notepad /p desktop\blank.txt (Which works fine if I manually type in the command) Does anyone know how to apply this using "SCHTASKS" ? Or possibly open my eyes to using a Batch File for the commands to run at specific times? I really appreciate all suggestions and efforts! Thanks Again! Another excellent result of using this command: "lpr -S ip_address -P lpt1 wakeup.txt" is that it spools the print job "blank.txt" without printing any actual data! (This means that we can re-use the paper, since it remains blank.) Something I was unable to do using the previous command: "notepad /p desktop\blank.txt" (which always required some data within the text file, and also printed "Page 1" at the bottom regardless. Now if I can only figure out how to automate the process, so it will do this every morning, and every 239 minutes until 7pm M-F! -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#10
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Klaus Jorgensen;3794684 Wrote: Gadgetman wrote: "lpr -S ip_address -P lpt1 wakeup.txt" It's very similar to the original command used: notepad /p desktop\blank.txt Yes, but that would require a printer driver - the lpr command sends a raw file to the printer. Does anyone know how to apply this using "SCHTASKS" ? Why not use the GUI to add the batch job? /klaus Funny you should mention that, as I'm attempting to create a working batch file which will execute the command line:"lpr -S ip_address -P lpt1 wakeup.txt" using the GUI "Scheduled Tasks" within XP. (If successful, it will most likely run using "AT" or "SCHTASKS" as well.) Just having trouble writing this Batch File (My first batch file) to execute properly. The batch file appears to run, but nothing occurs. Yet typing: "lpr -S ip_address -P lpt1 wakeup.txt" in the command manually, it executes flawlessly. (The printer spools!) Any Ideas / Suggestions? -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#11
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Gadgetman wrote:
Now if I can only figure out how to automate the process, so it will do this every morning, and every 239 minutes until 7pm M-F! schtasks /create /tn "Printer warm up" /sc weekly /ri 239 /d mon,tue,wed,thu,fri /st 10:00:00 /et 19:00:00 /tr c:\batch\wakeup.cmd /ru username /rp password Note this will only work on Server 2003 as XP does not support all the schtasks options. Also, I usually never put arguments in the command for a task - I prefer to launch a batch file with all the codings in it. /klaus |
#12
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Klaus Jorgensen;3795325 Wrote: Gadgetman wrote: Now if I can only figure out how to automate the process, so it will do this every morning, and every 239 minutes until 7pm M-F! schtasks /create /tn "Printer warm up" /sc weekly /ri 239 /d mon,tue,wed,thu,fri /st 10:00:00 /et 19:00:00 /tr c:\batch\wakeup.cmd /ru username /rp password Note this will only work on Server 2003 as XP does not support all the schtasks options. Also, I usually never put arguments in the command for a task - I prefer to launch a batch file with all the codings in it. /klaus The only problem I still face is the actual batch file not executing. I've tried it several different ways, using a "warmup.bat" and also "warmup.cmd" file to reference in the cmd string. The schtasks command string fires, yet nothing occurs at the printer end. I've narrowed it down to the .bat & .cmd file not executing: lpr -S MyIP_address -P 8550dp blank.txt Yet if I manually type the same command in the CMD prompt, it works? As stated previously, I'm new to creating batch files... So it must be my lack of knowledge of syntax for creating a proper batch file. I'm still experimenting... -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#13
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Gadgetman wrote:
The only problem I still face is the actual batch file not executing. I've tried it several different ways, using a "warmup.bat" and also "warmup.cmd" file to reference in the cmd string. The schtasks command string fires, yet nothing occurs at the printer end. I've narrowed it down to the .bat & .cmd file not executing: lpr -S MyIP_address -P 8550dp blank.txt Try redirecting the output of the lpr command to a log file: lpr -S MyIP_address -P 8550dp blank.txt lpr.log Then check the lpr.log for possible errors. Problems with scheduled batch jobs is often caused by not correctly referencing the involved files. Try using fully qualified file locations - e.g. c:\batch\blank.txt. /klaus |
#14
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Klaus Jorgensen;3796335 Wrote: Gadgetman wrote: The only problem I still face is the actual batch file not executing. I've tried it several different ways, using a "warmup.bat" and also "warmup.cmd" file to reference in the cmd string. The schtasks command string fires, yet nothing occurs at the printer end. I've narrowed it down to the .bat & .cmd file not executing: lpr -S MyIP_address -P 8550dp blank.txt Try redirecting the output of the lpr command to a log file: lpr -S MyIP_address -P 8550dp blank.txt lpr.log Then check the lpr.log for possible errors. Problems with scheduled batch jobs is often caused by not correctly referencing the involved files. Try using fully qualified file locations - e.g. c:\batch\blank.txt. /klaus Klaus, I feel like I'm so close on this... And I really appreciate your assistance on this one! No luck with the batch file still. I've attempted to try your suggestion for redirecting the output of the lpr command to a log file. (The log file remains blank?) Question:could it be due to the raw file data being passed? Also: do you have an example of a known working batch file syntax for using the LPR command? -- Gadgetman ------------------------------------------------------------------------ Gadgetman's Profile: http://forums.techarena.in/member.php?userid=51066 View this thread: http://forums.techarena.in/showthread.php?t=981521 http://forums.techarena.in |
#15
|
|||
|
|||
scheduled printing of a text file using batch files or schtasks
Gadgetman wrote:
Klaus Jorgensen;3796335 Wrote: Try redirecting the output of the lpr command to a log file: lpr -S MyIP_address -P 8550dp blank.txt lpr.log I've attempted to try your suggestion for redirecting the output of the lpr command to a log file. (The log file remains blank?) Question:could it be due to the raw file data being passed? Also: do you have an example of a known working batch file syntax for using the LPR command? If a log file is created and is empty, the lpr command is ok. If the raw file is empty, the printer might probably just ignore the file - try grab the output of a Windows test print to a test.prn and use that file with the lpr command. Also, the printer could be restrictive with the port name, try using lpt1, lp1 or pr1 instead of 8550dp. If a printer server box (e.g. JetDirect) has more than one port, the port name must specify the actual port, but with a built-in network card in the printer, it shouldn't really matter. /klaus |
|
Thread Tools | |
Display Modes | |
|
|