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-05 17:39
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [fixed] How can echo avoid a newline View 1,261 Replies 3
Original Poster Posted 2007-08-28 17:07 ·  中国 上海 电信数据中心
初级用户
★★
Credits 184
Posts 73
Joined 2007-05-24 18:06
19-year member
UID 89185
Gender Male
Status Offline
There is a file a.bat, with the following contents:

echo "aa" >>1.txt
echo dir /b >>1.txt

Enter a.bat "bb" in cmd
and it will append to the end of file 1.txt:
aa
(dirctories)
But what I want appended to the end of file 1.txt is:
aa(dirctories)
What should I do?
Note: that is, there is no carriage return after aa, it directly appends (dirctories)

[ Last edited by sinbao on 2007-8-29 at 01:43 PM ]
Floor 2 Posted 2007-08-29 01:18 ·  中国 上海 虹口区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
You can use the echos command. Of course, DOS's own command.com and Windows NTs' cmd.exe do not have this command. You can use 4DOS.COM as the command interpreter; under Windows you can use 4NT or Take Command as the command-line environment.
Floor 3 Posted 2007-08-29 09:44 ·  中国 上海 电信数据中心
初级用户
★★
Credits 184
Posts 73
Joined 2007-05-24 18:06
19-year member
UID 89185
Gender Male
Status Offline
The actual problem is this:
I want to generate a classpath string, but

set ClassPath=
for %%i in ("*") do set ClassPath=%ClassPath%;%%i

this won't work. In the end, ClassPath only gets the last file; it won't concatenate at all.

[ Last edited by sinbao on 2007-8-29 at 09:58 AM ]
Floor 4 Posted 2007-08-29 10:19 ·  中国 天津 电信
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
sinbao +1 2007-08-29 13:43
Forum Jump: