SEARCH

The How-To Geek Forums Have Migrated to Discourse

How-To Geek Forums / Tutorials

(Solved) - bat files

(9 posts)
  • Started 2 years ago by isodope
  • Latest reply from isodope
  • Topic Viewed 1312 times

isodope
Posts: 4

can anyone help me with writng bat file to display days of the week-Monday-Sunday and print them? using command line win7

Posted 2 years ago
Top
 
Xhi
Xhi
Posts: 6298

Could you explain further exactly what you want to do? you want to display the days of the week? Where? and print them where?

Posted 2 years ago
Top
 
isodope
Posts: 4

Hi-Thx for the reply-i just want to display them in cmd window and print to a local printer

Posted 2 years ago
Top
 
dysert
dysert
Posts: 13

Here is a .bat file that displays the days of the week...
@echo off
echo "Sunday"
echo "Monday"
echo "Tuesday"
echo "Wednesday"
echo "Thursday"
echo "Friday"
echo "Saturday"

To print the output, you could pipe the output to a printer, e.g., C:\>dow.bat | LPT1:
or you could send the output to a .txt file and then print that, e.g., with Notepad: C:\dow.bat > dow.txt

Hope this helps.

Posted 2 years ago
Top
 
ispalten
ispalten
Posts: 6259

Is it really that simple, you want to see it on your display and print it? If so, just create a TXT file, actually don't even need do that. Open Notepad, type in what you want and then Print... or do the above post?

We must be missing something here?

What do you really want?

Irv S.

Posted 2 years ago
Top
 
Xhi
Xhi
Posts: 6298

@dysert has a good start. Since most printers now days are connected to a USB port not an LPT: port, in order to send the print from DOS you would have to execute a command such as

NET USE LPT1: \\[Computer Name]\[Printer name] /PERSISTENT:YES

The parameters are dependent on how your printer is attached or shared.

Still nt understanding what you are trying to do and why. Sounds like it must be some kind of meaningless class assignment.

Posted 2 years ago
Top
 
isodope
Posts: 4

Hi-Thx for responding-Im just trying to figure out how things work in batch files and want to use CHOICE 1-7 for the days of the week-i had %monday% instead of quotes "monday"
I tried using

choose= set /m choice="please enter a number from the following:"
IF Not :"%choose%"=="" set
choice=%choice%:1%~7%

Im guessing the syntax is wrong as choice isnt recognized as internal or external command

Posted 2 years ago
Top
 
Lighthouse
Lighthouse
Posts: 13598

May help you,
http://www.computerhope.com/batch.htm

Accepted Answer · Posted 2 years ago
Top
 
isodope
Posts: 4

Thx for the link-exactly what i was lookin for-thx again to all );

Posted 2 years ago
Top
 



Topic Closed

This topic has been closed to new replies.