Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
taripo
- Posts: 228
- Joined: 01 Aug 2011 13:48
#1
Post
by taripo » 21 Feb 2014 10:15
This works as expected
Code: Select all
C:\>set/p=AAAAAAAA^|BBBBBBB
AAAAAAAA|BBBBBBB
C:\>
But I don't want to have to hit ENTER.
But if I do this, it doesn't work as expected.. I want it to do like the above but hitting ENTER
Code: Select all
C:\>echo.|set/p=AAAAAAAA^|BBBBBBB
'BBBBBBB' is not recognized as an internal or external command,
operable program or batch file.
C:\>
ultimately I want to do
Code: Select all
C:\>echo AAAAAA^|BBBBB>c:\crp\f.fff
C:\>
But without the CRLF at the end. So i'm using the echo.|set /p=_____ technique. But it's not working when the thing after the = contains a |
-
rodrigolima
- Posts: 21
- Joined: 19 Jul 2013 11:35
- Location: Brazil
#2
Post
by rodrigolima » 21 Feb 2014 10:46
Hello taripo
Try this:
>echo.&set/p=AAAAAAAA^|BBBBBBB [ENTER]
I hope that it be helpful for you.
See you
-
carlos
- Expert
- Posts: 503
- Joined: 20 Aug 2010 13:57
- Location: Chile
-
Contact:
#3
Post
by carlos » 21 Feb 2014 11:00
try use a file as input, in this case the nul special file that not have any data.
-
taripo
- Posts: 228
- Joined: 01 Aug 2011 13:48
#4
Post
by taripo » 21 Feb 2014 11:15
Thanks carlos that <nul solution e.g. set/p=dd^|fds<nul and set/p"=dd|fds"<nul works.
Rodrig, that which you mentions doesn't work, you still have to hit enter. The point was me not having to hit ENTER.
-
jeb
- Expert
- Posts: 1055
- Joined: 30 Aug 2007 08:05
- Location: Germany, Bochum
#5
Post
by jeb » 21 Feb 2014 14:11
Only for completness, you need three carets when using a pipe, or quote it
Code: Select all
echo. | set/p=AAAAAAAA^^^|BBBBBBB
echo. | set /p "=AAAAAAAA|BBBBBBB"
But at all this is a bad solution, carlos tip to use <nul is better, as it's much faster and with fewer problems
jeb
-
taripo
- Posts: 228
- Joined: 01 Aug 2011 13:48
#6
Post
by taripo » 21 Feb 2014 16:19
thanks..
so
looking at these 4 solutions
noted that <nul is better than echo.| or echo;|
so the latter two are the way to go
- echo. | set/p=AAAAAAAA^^^|BBBBBBB
- echo. | set /p "=AAAAAAAA|BBBBBBB"
- set/p "=AAAAAAAA|BBBBBBB" <nul
- set/p=AAAAAAAA^|BBBBBBB <nul
is the fourth one as good as the third one?
And why does the first one require that | to be escaped 3 times?