![]() |
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-04 07:54 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » How can I assign the output of type test.txt to a variable? |
| Printable Version 790 / 4 |
| Floor1 Dana | Posted 2007-04-23 07:18 |
| 初级用户 Posts 28 Credits 70 | |
|
How can I assign the output of type test.txt to a variable?
There is only one constantly changing number in the test.txt file. |
|
| Floor2 flyinspace | Posted 2007-04-23 07:21 |
| 银牌会员 Posts 517 Credits 1,206 | |
|
for /f "tokens=* " %%i in (test.txt) do echo %%i
Just change that last echo %%i however you like :) |
|
| Floor3 bjsh | Posted 2007-04-23 07:22 |
| 银牌会员 Posts 621 Credits 2,000 | |
|
Under cmd
for /f "delims=" %a in (text.txt) do set "a=%a" |
|
| Floor4 lxmxn | Posted 2007-04-23 08:31 |
| 版主 Posts 4,938 Credits 11,386 | |
|
If text.txt contains only one line, then you can do it like this:
set /p str=<test.txt echo %str% |
|
| Floor5 Dana | Posted 2007-04-23 10:01 |
| 初级用户 Posts 28 Credits 70 | |
|
Many thanks, everyone.....
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |