![]() |
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-07 08:37 |
48,040 topics / 350,125 posts / today 0 new / 48,252 members |
| DOS批处理 & 脚本技术(批处理室) » How to directly assign the output result of a DOS command to a variable in a batch script |
| Printable Version 1,768 / 8 |
| Floor1 hnhhcj | Posted 2006-11-30 00:57 |
| 新手上路 Posts 2 Credits 8 | |
|
As the title says
|
|
| Floor2 a9319751 | Posted 2006-11-30 05:54 |
| 中级用户 Posts 170 Credits 439 | |
|
for %%i in (命令) set %%i
|
|
| Floor3 tao0610 | Posted 2006-11-30 06:15 |
| 高级用户 Posts 218 Credits 579 | |
|
Put single quotes around the command, like ''command''
|
|
| Floor4 x412637729 | Posted 2006-12-11 01:06 |
| 初级用户 Posts 19 Credits 38 | |
|
Please provide the Chinese content that needs to be translated.
|
|
| Floor5 lifei666 | Posted 2006-12-19 10:13 |
| 初级用户 Posts 11 Credits 23 | |
|
Experts, give a detailed explanation!
|
|
| Floor6 sunyao | Posted 2006-12-19 22:54 |
| 初级用户 Posts 60 Credits 141 From 天津 | |
|
Just find the output of the 'command' and assign the output to the variable %i
|
|
| Floor7 jgc | Posted 2007-01-06 06:18 |
| 初级用户 Posts 20 Credits 153 | |
|
In addition, don't forget do and parameter /f.
Revised to: for /f %%i in ('command') do set %%i |
|
| Floor8 lxmxn | Posted 2007-01-06 07:16 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Revise again:[ Last edited by lxmxn on 2007-1-5 at 06:17 PM ]
|
|
| Floor9 plp626 | Posted 2008-01-22 00:22 |
| 银牌会员 Posts 1,020 Credits 2,278 | |
|
Why do you all use for? Don't you think the code is long?
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |