Quantcast
Channel: Manfaat Sehat
Viewing all articles
Browse latest Browse all 61

Windows Batch Script: Getting Unique IPv6 IP

$
0
0
This is a basic, somewhat dirty, Batch script to get a Windows IPv6 address into a text file to use as a unique identifier.  I used Windows Server 2008 for this script, to use in an Amazon EC2 AMI.


@echo off
rem IPv6.txt file creator
rem GPLv3 gnuski.blogspot.com
cd C:\
del c:\IPv6-1.txt
del c:\IPv6-2.txt
ipconfig.exe |find "IPv6 Address" |find /v "Link-local" > c:\IPv6-1.txt
for /f "tokens=2-8 delims=:" %%i in (IPv6-1.txt) do set IPv6a=%%i:%%j:%%k:%%l:%%m:%%n:%%o
echo.%IPv6a% > C:\IPv6-2.txt
for /f "tokens=1 delims= " %%a in (IPv6-2.txt) do set IPv6=%%a
echo.%IPv6% > C:\IPv6.txt
del c:\IPv6-1.txt
del c:\IPv6-2.txt

Your final file with the IPv6 address will be at C:\IPv6.txt

Viewing all articles
Browse latest Browse all 61

Trending Articles