![]() |
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-12 19:44 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Please come in and take a look, why can't this string be concatenated? |
| Printable Version 1,641 / 3 |
| Floor1 summerflower | Posted 2009-11-24 12:40 |
| 初级用户 Posts 17 Credits 36 | |
|
The batch file I wrote is as follows:
@echo off set a=h for /d %%f in ("c:\documents and settings\*") do set a=%%f\Cookies &@echo %a% What I originally meant was to turn a into a string like c:\documents and settings\username\Cookies, but when I print it with the above command, the value of environment variable a still has not changed and is still the initial value h. Question for all you experts, how exactly should this batch file be written? |
|
| Floor2 yishanju | Posted 2009-11-25 00:17 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
Take a look at tutorials related to environment variables.
|
|
| Floor3 lxmxn | Posted 2009-11-26 03:18 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Just change echo %a% to “call echo %%a%%”.
You can also do it with delayed variable expansion; there are lots of tutorials on the forum, search for them. |
|
| Floor4 summerflower | Posted 2009-11-27 14:20 |
| 初级用户 Posts 17 Credits 36 | |
|
Many thanks, moderator, I understand now
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |