|
| |||||||||
| Tags: batch file automation, cmd printing, local system, schtasks |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| scheduled printing of a text file using batch files or schtasks
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) Last edited by Gadgetman : 06-06-2008 at 12:28 AM. Reason: attempting to narrow down the better task at hand |
|
#2
| |||
| |||
|
*Note - this is using Windows XP Pro |
|
#3
| |||
| |||
| Re: 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 here: http://support.microsoft.com/search/?adv=1 This posting is provided "AS IS" with no warranties, and confers no rights. "Gadgetman" <Gadgetman.3ajnzd@DoNotSpam.com> wrote in message news:Gadgetman.3ajnzd@DoNotSpam.com... > > 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/members/51066.htm > View this thread: scheduled printing of a text file using batch files or schtasks > > http://forums.techarena.in > |
|
#4
| |||
| |||
| Re: 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 -- hhh@kvoa.com 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" <Gadgetman.3ajnzd@DoNotSpam.com> wrote in message news:Gadgetman.3ajnzd@DoNotSpam.com... > > 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/members/51066.htm > View this thread: scheduled printing of a text file using batch files or schtasks > > http://forums.techarena.in > |
|
#5
| |||
| |||
| Re: 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. |
|
#6
| |||
| |||
| Re: scheduled printing of a text file using batch files nha@horten.dk 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 |
|
#7
| |||
| |||
|
(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.) Last edited by Gadgetman : 11-06-2008 at 12:48 AM. Reason: Missing Bracket in sentence |
|
#8
| |||
| |||
| Quote:
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! |
|
#9
| |||
| |||
| Re: 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 |
|
#10
| |||
| |||
| Quote:
"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! |
|
#11
| |||
| |||
| Quote:
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? |
|
#12
| |||
| |||
| Re: 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 |
|
#13
| |||
| |||
| Quote:
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... |
|
#14
| |||
| |||
| Re: 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 |
|
#15
| |||
| |||
| Quote:
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? |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "scheduled printing of a text file using batch files or schtasks" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DSMOD from batch and text file | Pete Jones | Active Directory | 3 | 04-03-2010 12:42 AM |
| batch file to split multiple text files in half. | yammyguy | Server Scripting | 8 | 11-05-2009 06:19 PM |
| Problems running batch file as scheduled task | pete0085 | Windows Server Help | 7 | 01-01-2009 02:15 PM |
| Unable to start scheduled task after creating it with Schtasks | Flea# | Windows Server Help | 7 | 09-03-2008 05:56 AM |
| schtasks to call batch file. | am_shraddha | Software Development | 0 | 13-03-2007 07:22 PM |