China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 07:05
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to bind the network card address to the same file View 1,664 Replies 10
Original Poster Posted 2008-01-26 16:11 ·  中国 浙江 杭州 网易云BGP数据中心
中级用户
★★
Credits 234
Posts 119
Joined 2007-04-22 11:09
19-year member
UID 86077
Gender Male
Status Offline
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.
Floor 2 Posted 2008-01-26 16:18 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Extract network card address using for + findstr + ipconfig

Renames...

Take a look at an example of extracting IP
Floor 3 Posted 2008-01-27 13:38 ·  中国 北京 北京诚亿时代网络工程技术有限公司电信节点
中级用户
★★
Credits 234
Posts 119
Joined 2007-04-22 11:09
19-year member
UID 86077
Gender Male
Status Offline
Not quite clearly. Can you elaborate in detail?
Floor 4 Posted 2008-01-27 15:29 ·  中国 江西 南昌 电信
中级用户
★★
Credits 234
Posts 119
Joined 2007-04-22 11:09
19-year member
UID 86077
Gender Male
Status Offline
Is there anyone who can help me? Urgent~~~ It's almost the end of the year. The unit is waiting to solve it.
Floor 5 Posted 2008-01-27 16:17 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
@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
Floor 6 Posted 2008-01-27 18:21 ·  中国 北京 北京诚亿时代网络工程技术有限公司电信节点
中级用户
★★
Credits 234
Posts 119
Joined 2007-04-22 11:09
19-year member
UID 86077
Gender Male
Status Offline
Many thanks
Floor 7 Posted 2008-02-02 10:09 ·  中国 河南 南阳 电信
初级用户
Credits 61
Posts 32
Joined 2007-05-11 20:17
19-year member
UID 88214
Gender Male
Status Offline
Post some batch scripts for sharing
Floor 8 Posted 2008-02-05 18:28 ·  中国 北京 北京诚亿时代网络工程技术有限公司电信节点
中级用户
★★
Credits 234
Posts 119
Joined 2007-04-22 11:09
19-year member
UID 86077
Gender Male
Status Offline
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
Floor 9 Posted 2008-02-06 05:11 ·  中国 广东 东莞 电信
中级用户
★★
Credits 326
Posts 152
Joined 2007-05-04 06:16
19-year member
UID 87412
Gender Male
Status Offline
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.
Floor 10 Posted 2010-11-18 16:19 ·  中国 上海 电信
新手上路
Credits 17
Posts 6
Joined 2008-09-22 14:20
17-year member
UID 126302
Gender Male
Status Offline
Have the same idea as the LZ, try the slore method. Thanks!
Floor 11 Posted 2010-12-18 18:09 ·  中国 上海 浦东新区 电信
初级用户
Credits 23
Posts 12
Joined 2006-02-12 22:28
20-year member
UID 50257
Status Offline
If there are multiple network cards, the method on the fifth floor will be invalid.
Forum Jump: