中国DOS联盟论坛

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-10-01 17:00
47,813 topics / 349,918 posts / today 0 new / 48,279 members
DOS批处理 & 脚本技术(批处理室) » [Original] Fully Automatic Tool for Setting Machine Numbers and IP (Absolutely Practical)
Printable Version  27,664 / 148
Floor91 slzzj Posted 2007-06-23 21:12
新手上路 Posts 1 Credits 2
Thanks a lot. Just what I needed.
Floor92 gmsx007 Posted 2007-07-02 04:30
初级用户 Posts 36 Credits 75
Good things are shared by everyone, and everyone studies them!
Floor93 helixgentoo Posted 2007-07-05 02:56
新手上路 Posts 1 Credits 2
Floor94 ssay Posted 2007-07-05 11:09
新手上路 Posts 5 Credits 10
Ask the LZ and all the experts:

In the LZ's code:

for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do (
set mac=%%i
set mac=!mac:~0,-1!
)

What does!mac:~0,-1! mean?

I learned batch processing a long time ago, but very superficially. I checked some materials, and in the article by moderator lxmxn, it is mentioned:
! !
① When variable delay is enabled, using!! to enclose the variable name means to reference the variable value.
But I still can't infer the function of!mac:~0,-1!.

Please be generous to give your advice! Thanks a lot!
Floor95 qasa Posted 2007-07-07 01:38
高级用户 Posts 311 Credits 959 From 广东-LianJiang


!mac:~0,-1!


Extract all characters of the mac variable except the last one.

You can use
set /?

to take a look.


[ Last edited by qasa on 2007-7-7 at 01:40 AM ]
Floor96 wzw528 Posted 2007-07-08 21:09
新手上路 Posts 1 Credits 2
Support
Floor97 beyoungse Posted 2007-07-12 22:40
中级用户 Posts 112 Credits 253
Floor98 oioc Posted 2007-07-13 06:18
初级用户 Posts 15 Credits 34
????:lol::lol::lol:

[ Last edited by oioc on 2007-7-16 at 06:22 AM ]
Floor99 429499381 Posted 2007-07-13 07:34
中级用户 Posts 202 Credits 452
Actually, I already knew about this tool a long time ago, but I haven't used it. Now the internet café is about to change the system, so it's just right to test it. However, before that, I hope you can improve its fully automatic function!

Can the data format in your MAC file be changed to be like the format scanned out in the A-D tool kit? That way, there's no need to change the format one by one, or you can directly write a batch script to scan MAC, IP, and computer name.

Actually, I can also do it, but it will take time. I'm not as skilled as you, so if you don't want to do it, I'll spend some time making it and integrate it with your tool to truly achieve full automation!!!
Floor100 myname1994 Posted 2007-07-13 08:40
初级用户 Posts 30 Credits 65
Not bad. I was just thinking about writing one during the holiday. For computer lab management.
Floor101 luowei14 Posted 2007-07-13 11:10
初级用户 Posts 98 Credits 193
...Learned it...
Floor102 ncqingyi Posted 2007-07-13 12:19
初级用户 Posts 11 Credits 24
setlocal enabledelayedexpansion
This command is of utmost importance.

Additionally, to change the computer name, you can use the WMIC method.
Floor103 ncqingyi Posted 2007-07-13 12:25
初级用户 Posts 11 Credits 24
Originally posted by 5639863 at 2007-6-18 11:29 AM:
Well, it's really powerful, but now I find that most of these tools can not modify connections like Local Area Connection 2 or Local Area Connection 3! But this tool has greatly facilitated network administrators


Configure or update IP address:
wmic nicconfig where index=0 call enablestatic("192.168.1.5"), ("255.255.255.0")

; index=0 means to configure network interface 1. index=1 means to modify the second one.

Configure gateway (default route):
wmic nicconfig where index=0 call setgateways("192.168.1.1"),(1)

The following is the list of my two network cards, only the first one is, the others are not.

Broadcom NetXtreme 57xx
RAS Synchronous Adapter
Packet Scheduler Miniport
WAN Miniport (L2TP)
WAN Miniport (PPTP)
WAN Miniport (PPPOE)
Direct Parallel
WAN Miniport (IP)
Packet Scheduler Miniport
WAN Miniport (IPX)

Then use WMIC to do Output to achieve self-judgment.
Floor104 ask5 Posted 2007-07-13 14:19
新手上路 Posts 1 Credits 2
Floor105 qasa Posted 2007-07-26 15:55
高级用户 Posts 311 Credits 959 From 广东-LianJiang
Reply to post 97 and post 104, such problems have long been solved, and it's actually very simple. Whether you are Local Area Connection 1, Local Area Connection 2, Local Area Connection 3...... it's all okay. Now attach the code for everyone to see.

Prev  1 … 4 5 6 7 8 9 10  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023