![]() |
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 09:53 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] How to bind the network card address to the same file |
| Printable Version 1,816 / 10 |
| Floor1 w1314ich | Posted 2008-01-26 16:11 |
| 中级用户 Posts 119 Credits 234 | |
|
There are a batch of machines in the unit. There is an IPMAC.txt file in the IP folder of the C drive of each machine. Every day after work, all machines send the IPMAC.txt file to the host at 6:00 on time for verification. Now I want to rename the received IPMAC.txt files before sending them, otherwise the host will only receive one file. The requirement for renaming is IPMAC.txt → IPMAC(MAC physical address of the network card).txt, and then send IPMAC(MAC physical address of the network card).txt to the host. I will write the sending part with a batch file, but I don't know how to use P to write the renaming part. Please ask the experts for guidance.
|
|
| Floor2 slore | Posted 2008-01-26 16:18 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
Extract network card address using for + findstr + ipconfig
Renames... Take a look at an example of extracting IP |
|
| Floor3 w1314ich | Posted 2008-01-27 13:38 |
| 中级用户 Posts 119 Credits 234 | |
|
Not quite clearly. Can you elaborate in detail?
|
|
| Floor4 w1314ich | Posted 2008-01-27 15:29 |
| 中级用户 Posts 119 Credits 234 | |
|
Is there anyone who can help me? Urgent~~~ It's almost the end of the year. The unit is waiting to solve it.
|
|
| Floor5 slore | Posted 2008-01-27 16:17 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
@echo off
echo The MAC address is: for /f "tokens=1,3 delims=:. " %%i in ('ipconfig /all') do ( if "%%i"=="Physical" (Set Mac=%%j&&goto :ExitFor) ) :ExitFor echo ren IPMAC.txt --^> IPMAC(%Mac%).txt pause>nul |
|
| Floor6 w1314ich | Posted 2008-01-27 18:21 |
| 中级用户 Posts 119 Credits 234 | |
|
Many thanks
|
|
| Floor7 diangongban | Posted 2008-02-02 10:09 |
| 初级用户 Posts 32 Credits 61 | |
|
Post some batch scripts for sharing
|
|
| Floor8 w1314ich | Posted 2008-02-05 18:28 |
| 中级用户 Posts 119 Credits 234 | |
|
Sending part (the receiving host needs to have FTP service enabled):
@echo off echo open 192.168.0.2(host address)>c:\ftp.txt echo 123(ftp account)>>c:\ftp.txt echo 123(ftp password)>>c:\ftp.txt echo put C:\ip\IPMAC.txt>>c:\ftp.txt echo bye>>c:\ftp.txt ftp -s:c:\ftp.txt del c:\ftp.txt |
|
| Floor9 qq43142691 | Posted 2008-02-06 05:11 |
| 中级用户 Posts 152 Credits 326 | |
|
It's okay to open a share with write permissions. Why use the external network?? This is actually very simple. You can get inspiration by referring to the batch script for changing IP based on MAC that I posted before. The principle is basically the same.
|
|
| Floor10 sbyywf | Posted 2010-11-18 16:19 |
| 新手上路 Posts 6 Credits 17 | |
|
Have the same idea as the LZ, try the slore method. Thanks!
|
|
| Floor11 shengping | Posted 2010-12-18 18:09 |
| 初级用户 Posts 12 Credits 23 | |
|
If there are multiple network cards, the method on the fifth floor will be invalid.
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |