windows - Retrieving all Ethernet Card id's and Respective IP Address and Hexadecimal conversion of string using a batch file -
i've written batch file. stuck 2 issues:
1) connected ethernet id's , ip addresses associated it. 2) converting hexadecimal string (volume serial number) decimal value.
i 1 ethernet card id , 1 ip address.
here's code:
@echo off ver | find /i "version 6.2." > nul if %errorlevel%==0 set $versionwindows=windows 8 ver | find /i "version 6.1." > nul if %errorlevel%==0 set $versionwindows=windows 7 ver | find /i "version 6.0." > nul if %errorlevel%==0 set $versionwindows=windows vista ver | find /i "version 5.1." > nul if %errorlevel%==0 set $versionwindows=windows xp ver | find /i "version 5.2." > nul if %errorlevel%==0 set $versionwindows=windows 2003 ver | find /i "windows 2000" > nul if %errorlevel%==0 set $versionwindows=windows 2000 ver | find /i "windows nt" > nul if %errorlevel%==0 set $versionwindows=windows nt ver | find /i ">windows me" > nul if %errorlevel%==0 set $versionwindows=windows me ver | find /i "windows 98" > nul if %errorlevel%==0 set $versionwindows=windows 98 ver | find /i "windows 95" > nul if %errorlevel%==0 set $versionwindows=windows 95 if not exist "%systemdrive%\program files (x86)" set $versionbit=32 bit if exist "%systemdrive%\program files (x86)" set $versionbit=64 bit /f "tokens=*" %%a in ('ver') (set myversion=%%a) /f "skip=1 tokens=5" %%s in ('vol c:') set volc=%%s /f "skip=1 tokens=5" %%s in ('vol %~d0') set volcur=%%s /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i "physical"') set macid=%%i /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i "host"') set hostname=%%i /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i "ip"') set ipaddr=%%i /f "tokens=2-4 delims=/ " %%a in ('date /t') (set mydate=%%c-%%a-%%b) /f "tokens=1-2 delims=/:" %%a in ('time /t') (set mytime=%%a:%%b) echo batchfile version: 1.0 echo ------------------------------ set /p "org_name=enter organization name: " set /p "user_name=enter name: " echo batchfile version: 1.0>>%org_name%.txt echo ------------------------------>>%org_name%.txt @echo: echo note: below information collected machine, please send information saved in %org_name%.txt present in current directory verification.>>%org_name%.txt @echo: echo please send information saved in %org_name%.txt present in current directory verification. @echo:>>%org_name%.txt echo batchfile version: 1.0>>%org_name%.txt echo organization name : %org_name%>>%org_name%.txt echo user name : %user_name%>>%org_name%.txt echo os name/ version : %myversion%>>%org_name%.txt echo os type : %$versionbit%>>%org_name%.txt echo c: volume serial number : %volc%>>%org_name%.txt echo current drive vol ser no.: %volcur%>>%org_name%.txt echo current drive letter : %~d0>>%org_name%.txt echo ethernet card id :%macid%>>%org_name%.txt echo date : %mydate%>>%org_name%.txt echo time : %mytime%>>%org_name%.txt echo host name :%hostname%>>%org_name%.txt echo ip address :%ipaddr%>>%org_name%.txt pause
help me, thanks...
Comments
Post a Comment