China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-11 06:19
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Fixed] What do I do if << can't be used in a batch file? Can everyone help? View 848 Replies 3
Original Poster Posted 2009-01-11 21:01 ·  中国 广东 东莞 电信
初级用户
Credits 41
Posts 37
Joined 2009-01-09 20:01
17-year member
UID 136255
Gender Male
From 四川南充
Status Offline
I have a text file, name.txt, with only one line in it as follows:
B190

I wrote a batch file with the following contents:
@echo off
ping -a -n 4 -r 5 <<name.txt
@pause
When I run this batch file, it just flashes by, sweat, sweat
So I changed the bat, changing ping -a -n 4 -r 5 <<name.txt
to ping -a -n 4 -r 5 <name.txt
Then it shows: IP address must be specified.
I remember that on a Win98 machine I used <<, but now on WinXP I can't see any effect. What should I do? Is the command wrong?
At first I thought maybe you couldn't use a computer name and had to use an IP; but after I changed it to an IP, it was still the same effect, sweat, sweat, sweat, sweat. I'd appreciate some guidance from the seniors, many thanks!

[ Last edited by HAT on 2009-1-13 at 14:33 ]
Floor 2 Posted 2009-01-12 13:59 ·  中国 广东 中山 电信
新手上路
Credits 4
Posts 4
Joined 2009-01-10 12:56
17-year member
UID 136300
Gender Male
Status Offline
Maybe you wrote it backwards, it should be >>, right.
Floor 3 Posted 2009-01-12 14:31 ·  中国 广东 深圳 电信
初级用户
★★
游手好闲 + 无所事事 ..
Credits 194
Posts 167
Joined 2007-04-30 09:43
19-year member
UID 87022
Gender Male
Status Offline
No idea why this happens... let's wait together.

If it's urgent, use the temporary workaround below:
for /f %%i in (name.txt) do ping -a -n 4 -r 5 %%i
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
HAT +2 2009-01-13 14:33
Floor 4 Posted 2009-01-13 13:22 ·  中国 广东 潮州 电信
初级用户
Credits 41
Posts 37
Joined 2009-01-09 20:01
17-year member
UID 136255
Gender Male
From 四川南充
Status Offline
Many thanks to post #3.
Also thanks to post #2, but maybe post #2 didn't understand what I meant
Forum Jump: