中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-03 21:29
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Help: a batch file to display output in columns
Printable Version  1,025 / 14
Floor1 bza2006 Posted 2007-03-23 09:52
初级用户 Posts 27 Credits 58
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.
Floor2 lxmxn Posted 2007-03-23 10:07
版主 Posts 4,938 Credits 11,386

  What do you mean? Please describe the problem more clearly, so everyone can think of a solution.
Floor3 bza2006 Posted 2007-03-23 10:24
初级用户 Posts 27 Credits 58
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 ]
Floor4 lxmxn Posted 2007-03-23 10:46
版主 Posts 4,938 Credits 11,386


system
mobile
mouse
sdfssadf
fdsfff
sfdsdf
gujhtfj


Where did the above section come from?
Floor5 everest79 Posted 2007-03-23 15:40
金牌会员 Posts 1,127 Credits 2,564
This seems to have something to do with tab,
Floor6 bza2006 Posted 2007-03-23 20:48
初级用户 Posts 27 Credits 58
I edited the post a bit
Floor7 bza2006 Posted 2007-03-24 01:42
初级用户 Posts 27 Credits 58
Impossible to do?
Floor8 lxmxn Posted 2007-03-24 02:01
版主 Posts 4,938 Credits 11,386

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.
Floor9 ccwan Posted 2007-03-24 02:27
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
There is no all-purpose code. I hope the OP can explain the requirements clearly, then lxmxn can give you the code.
Floor10 lxmxn Posted 2007-03-24 03:18
版主 Posts 4,938 Credits 11,386
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*~
Floor11 bza2006 Posted 2007-03-24 06:52
初级用户 Posts 27 Credits 58
Just check it—if there isn't enough, then don't arrange it.
Floor12 flyinspace Posted 2007-03-25 02:00
银牌会员 Posts 517 Credits 1,206
Hehe. I wrote the arranging part for you.

As for the rest,

I believe you can handle it yourself. . .
Floor13 everest79 Posted 2007-03-25 08:42
金牌会员 Posts 1,127 Credits 2,564
Floor14 bza2006 Posted 2007-03-25 21:09
初级用户 Posts 27 Credits 58
Many thanks to everyone for the pointers
Floor15 ccwan Posted 2007-03-25 21:46
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Looks like the OP has already achieved the goal, so I won't post brother 9527's code here.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023