本帖最后由 pcl_test 于 2016-11-10 14:22 编辑
- @echo off&setlocal enabledelayedexpansion
- %1(for /f "tokens=2 delims==" %%a in ('"%~f0" ::^|sort') do echo;%%a)&pause&exit
- for /f "tokens=1-4 delims=." %%a in ('type "ip.txt"') do (
- set /a "a=100+%%a,b=100%%b,c=100+%%c,d=100+%%d"
- echo;!a!!b!!c!!d!=%%a.%%b.%%c.%%d
- )
复制代码
- rem win7及以上系统运行
- powershell -c "gc 'ip.txt'|sort {$a=$_.trim().split('.');'{0:d3}{1:d3}{2:d3}{3:d3}' -f (1*$a[0]),(1*$a[1]),(1*$a[2]),(1*$a[3])}"
- pause
复制代码
|