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 "getinput" 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 "call". Is there any way to get rid of the extra CR?
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 "getinput" 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 "call". Is there any way to get rid of the extra CR?