Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS: Can "CALL" run without carriage return?

Status
Not open for further replies.

jonnysnow

Programmer
Apr 10, 2003
36
US
Is there an easy way to call "CALL" in a batch file, but not have it send a carriage return (CR) to the DOS window?

What I'm trying to do is get user input and test its value, and I want to control the CR's.

My batch file looks something like this, using some dummy commands:
[tt]
:LOOP
getinput
: Let's say user enters '9'

buildbatch > RUN1.BAT : File RUN1.BAT will now contain
: text 'set ANS=9'

call RUN1.BAT : Call the batch file, BUT get
: an unwanted CR in the process

if %ANS% == 1 goto OK : Allow only '1' or '2' as good
if %ANS% == 2 goto OK : responses
goto LOOP

:OK
<continue>
[/tt]


Let's assume that &quot;getinput&quot; gives a different prompt when the user's response is bad.

At first, the user sees:
[tt]
Enter selection:
[/tt]

If the user enters a bad choice, then the display reads:
[tt]
Enter selection: 9
Please enter a valid response:
[/tt]

And again--
[tt]
Enter selection: 9
Please enter a valid response: 6
Please enter a valid response:
[/tt]


What I'm getting is an extra line:
[tt]
Enter selection: 9

Please enter a valid response: 6

Please enter a valid response:
[/tt]


I've tracked this down to &quot;call&quot;. Is there any way to get rid of the extra CR?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top