msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Direct input from console to LOOP

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB DOS
Author Message
user



Joined: 04 Oct 2007
Posts: 1

PostPosted: Thu Jun 01, 2006 5:47 pm    Post subject: Direct input from console to LOOP Reply with quote

I'm trying to write a batch file that will print labels on a thermal
printer. I already have the code to make the label print by using the "copy
/b file.prn lpt1". Now I want it to loop this command for however many
labels they want printed. I've been beating my brains in for the past 2
days ( haven't messed with DOS for quite some time ) and just can't get it
to take the input as a variable and pass it to the loop.

Example of what I want this thing to do:

Ask: How many labels would you like to print? ( input a number from 1 to
100 here )

Take that number and send it to a loop to run this command "copy /b file.prn
lpt1" until it reaches the amount they want and then end.

any help would be appreciated.

Thanks,

Mike

Archived from group: microsoft>public>vb>dos
Back to top
View user's profile Send private message
Mario Díaz



Joined: 04 Oct 2007
Posts: 1

PostPosted: Thu Jun 01, 2006 8:35 pm    Post subject: RE: Direct input from console to LOOP Reply with quote

Mike:
I hope this work for you

count.bat
---------------------------------------------
@echo off
set count=
:loop
set count=%count%-
copy /b file.prn lpt1
if not "%count%"=="%1" %then% goto loop
%else% set count=
---------------------------------------------
usage: you must pass a string parameter "-" with the lenght of the copies.
example with 5 copies:

count.bat -----

take care of the environmment space when printing a lot of labels...


"none" wrote:

> I'm trying to write a batch file that will print labels on a thermal
> printer. I already have the code to make the label print by using the "copy
> /b file.prn lpt1". Now I want it to loop this command for however many
> labels they want printed. I've been beating my brains in for the past 2
> days ( haven't messed with DOS for quite some time ) and just can't get it
> to take the input as a variable and pass it to the loop.
>
> Example of what I want this thing to do:
>
> Ask: How many labels would you like to print? ( input a number from 1 to
> 100 here )
>
> Take that number and send it to a loop to run this command "copy /b file.prn
> lpt1" until it reaches the amount they want and then end.
>
> any help would be appreciated.
>
> Thanks,
>
> Mike
>
>
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Console application closes I am creating very simple console applications using Visual Basic in Visual Studio .NET. When I run the program (using the start button in the Visual Studio IDE) the program runs but it immediately closes the DOS window and therefore does not present me w

Print output to Console Hi a simple question here. I know "Command" is for us to read something from DOS. How about if I want to print some output to the console? Thanks in advance!

How to collect user input in combo box ... Yep, me again with more problems :( but at least this should be easy for you gurus. I have a combo box with numbers (say) 1-99 available in a drop-down for the users to choose from. However I am having a problem finding a means to user in

reading keyboard with direct input question (dx 9, vb.net) I want to be able to read if a key is pressed - actually multiple keys. If all 101 keys are pressed I need to know. Are there any advantages to using Direct Input over a regular keypress event? I am new to using Direct Input and am working

For Each loop getting caught in infinite loop. Anybody ever heard of a For Each Next loop getting hung up on a distributed vb.net windows app ...on some PC's when the application is running, but not on other PC's. Is there a library i may be missing on the PC that cant run the app? Its a simple For E
Post new topic   Reply to topic    msvisual.com Forum Index -> VB DOS All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group