中国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-09-23 14:46
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » How to set the content in the file as a variable?? Urgent, waiting online
Printable Version  1,925 / 2
Floor1 van416 Posted 2010-12-28 18:45
初级用户 Posts 30 Credits 34
Dear friends:

Ask a simple question, how to set the content in the file as a variable?

For example, the content of question1.txt is: abc
How can I set abc as $a

Thanks
Floor2 DXSX Posted 2010-12-29 08:59
中级用户 Posts 147 Credits 247
Use the external command `nset`
`nset /l1 A=$1 <1.txt`

Indicates that the first word of the first line in 1.txt is assigned to variable A
Floor3 liion631818 Posted 2010-12-31 16:46
新手上路 Posts 11 Credits 13 From 上海
$a???dos or shell?
If it's DOS, you use a for loop, and in shell, directly use `cat 1.txt`, with backticks around cat
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023