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-03 22:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Help: a batch file to display output in columns View 1,027 Replies 14
Original Poster Posted 2007-03-23 09:52 ·  中国 河南 新乡 联通
初级用户
Credits 58
Posts 27
Joined 2007-03-21 06:36
19-year member
UID 82427
Gender Male
Status Offline
For example, output like dir or tasklist, with a certain format.
Specifically, like this: enter several strings at a time, and display them in any number of rows and columns.
Floor 2 Posted 2007-03-23 10:07 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  What do you mean? Please describe the problem more clearly, so everyone can think of a solution.
Floor 3 Posted 2007-03-23 10:24 ·  中国 河南 新乡 联通
初级用户
Credits 58
Posts 27
Joined 2007-03-21 06:36
19-year member
UID 82427
Gender Male
Status Offline
Display in matrix form, with custom rows and columns. The content is strings. To be more specific, the following strings:
system
mobile
mouse
sdfssadf
fdsfff
sfdsdf
gujhtfj
.......

The column above is in one text file, and it is converted into the following format in another text file.

Split it into n columns for display:
system sdfssadf ...
mobile fdsfff
mouse sfdsdf
...

[ Last edited by bza2006 on 2007-3-23 at 07:47 AM ]
Floor 4 Posted 2007-03-23 10:46 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline


system
mobile
mouse
sdfssadf
fdsfff
sfdsdf
gujhtfj


Where did the above section come from?
Floor 5 Posted 2007-03-23 15:40 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
This seems to have something to do with tab,
Floor 6 Posted 2007-03-23 20:48 ·  中国 河南 新乡 联通
初级用户
Credits 58
Posts 27
Joined 2007-03-21 06:36
19-year member
UID 82427
Gender Male
Status Offline
I edited the post a bit
Floor 7 Posted 2007-03-24 01:42 ·  中国 河南 新乡 联通
初级用户
Credits 58
Posts 27
Joined 2007-03-21 06:36
19-year member
UID 82427
Gender Male
Status Offline
Impossible to do?
玄之又玄
众妙之门
Floor 8 Posted 2007-03-24 02:01 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

This should be possible, but not in the way you said, where you can have however many rows and however many columns you want. If a file only has 3 lines of strings, then it's impossible to arrange it into 2 columns and 4 rows.
Floor 9 Posted 2007-03-24 02:27 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
There is no all-purpose code. I hope the OP can explain the requirements clearly, then lxmxn can give you the code.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 10 Posted 2007-03-24 03:18 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by ccwan at 2007-3-23 13:27:
There is no all-purpose code. I hope the OP can explain the requirements clearly, then lxmxn can give you the code.


*facepalm*~
Floor 11 Posted 2007-03-24 06:52 ·  中国 河南 新乡 联通
初级用户
Credits 58
Posts 27
Joined 2007-03-21 06:36
19-year member
UID 82427
Gender Male
Status Offline
Just check it—if there isn't enough, then don't arrange it.
玄之又玄
众妙之门
Floor 12 Posted 2007-03-25 02:00 ·  中国 广东 广州 联通
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
Hehe. I wrote the arranging part for you.

As for the rest,

I believe you can handle it yourself. . .
Floor 13 Posted 2007-03-25 08:42 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Floor 14 Posted 2007-03-25 21:09 ·  中国 河南 新乡 联通
初级用户
Credits 58
Posts 27
Joined 2007-03-21 06:36
19-year member
UID 82427
Gender Male
Status Offline
Many thanks to everyone for the pointers
玄之又玄
众妙之门
Floor 15 Posted 2007-03-25 21:46 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Looks like the OP has already achieved the goal, so I won't post brother 9527's code here.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Forum Jump: