Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



scheduled printing of a text file using batch files or schtasks

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 05-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 7
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
Reply With Quote
  #2  
Old 05-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 7
*Note - this is using Windows XP Pro
Reply With Quote
  #3  
Old 06-06-2008
Member
 
Join Date: Nov 2005
Posts: 3,023
Re: scheduled printing of a text file using batch files

I think that the question that you are asking is for a scheduled task rather than a printing question. So, I have never used the schtasks command till now. There might be someone who can help you out.
Reply With Quote
  #4  
Old 06-06-2008
Member
 
Join Date: Nov 2005
Posts: 625
Re: scheduled printing of a text file using batch files

I am also not a scheduled task expert but in looking at the syntax for the schtasks command and the /S switch, I think that if you use this switch you should provide a remote system argument for it, your example has no remote system argument defined. Incase you leave the /S out, help indicates the system parameter defaults to the local system. The /P switch would require a /U username if used. It seems like using /RP System would run everything under the system account.
Reply With Quote
  #5  
Old 11-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 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.)
Reply With Quote
  #6  
Old 11-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 7
"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!
Reply With Quote
  #7  
Old 11-06-2008
Member
 
Join Date: Nov 2005
Posts: 609
Re: scheduled printing of a text file using batch files or schtasks

Yeah, but it would require a printer driver, the lpr command sends a raw file to the printer. Why dont you use the GUI to add the batch job?
Reply With Quote
  #8  
Old 11-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 7
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!
Reply With Quote
  #9  
Old 11-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 7
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?
Reply With Quote
  #10  
Old 11-06-2008
Member
 
Join Date: Nov 2005
Posts: 709
Re: scheduled printing of a text file using batch files or schtasks

You can try to use the below:

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

It will only work on Server 2003 and XP will not support all the schtasks options. Also, I usually never put arguments in the command for a task, I would like to launch a batch file with all the codings in it.
Reply With Quote
  #11  
Old 12-06-2008
Member
 
Join Date: Jun 2008
Location: Pagosa Springs,Co
Posts: 7
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...
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "scheduled printing of a text file using batch files or schtasks"
Thread Thread Starter Forum Replies Last Post
Editing text file using a batch file beelow Software Development 8 09-03-2010 12:27 AM
DSMOD from batch and text file BUKSIS Active Directory 2 03-03-2010 10:07 PM
batch file to split multiple text files in half. yammyguy Windows Server Help 8 11-05-2009 06:19 PM
Problems running batch file as scheduled task pete0085 Windows Server Help 7 01-01-2009 03:15 PM
Unable to start scheduled task after creating it with Schtasks Flea# Windows Server Help 7 09-03-2008 05:56 AM


All times are GMT +5.5. The time now is 05:10 AM.