![]() |
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 10:28 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Urgent help needed: how to output | as a symbol instead of a command |
| Printable Version 887 / 3 |
| Floor1 kuzei | Posted 2007-02-01 01:34 |
| 新手上路 Posts 4 Credits 8 | |
|
I want to make a batch file output a format like this into a text file
00-5E-8A-EE-8D-0D=192.168.0.37|37-YZ This is the batch file I made ipconfig /all >e:\ipconfig.txt find "Physical Address" e:\ipconfig.txt >e:\phyaddr.txt for /f "skip=2 tokens=12" %%M in (e:\phyaddr.txt) do set Mac=%%M ;The problem is here echo %Mac%=192.168.0.%1|%1-YZ >>c:\1.txt The | in the middle is the same as the pipe command under DOS, so if I change it to echo %Mac%=192.168.0.%1"|"%1-YZ >>c:\1.txt the output format becomes 00-5E-8A-EE-8D-0D=192.168.0.37"|"37-YZ Could one of the experts point me to a solution? [ Last edited by kuzei on 2007-2-1 at 01:40 AM ] |
|
| Floor2 namejm | Posted 2007-02-01 01:35 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Write it as echo %Mac%=192.168.0.%1^|%1-YZ >>c:\1.txt。
[ Last edited by namejm on 2007-1-31 at 12:47 PM ] |
|
| Floor3 kuzei | Posted 2007-02-01 01:50 |
| 新手上路 Posts 4 Credits 8 | |
Originally posted by namejm at 2007-2-1 01:35: Tested, it works~ many thanks Could you also explain what the ^ symbol does? |
|
| Floor4 SpikeKnox | Posted 2007-02-01 15:39 |
| 初级用户 Posts 28 Credits 116 | |
|
The ampersand (&), pipe (|), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments.
& | ( ) are all special characters. When these characters are passed as arguments, you must add the escape character ^ or put them in quotation marks. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |