|
本帖最后由 holley2008 于 2022-9-15 15:49 编辑
没搞懂你的意思,简单合并就这样
- @echo off & setlocal enabledelayedexpansion
- echo =-----------------------------------------=
- echo = 本BAT只列出一个有线和一个无线的IP信息 =
- echo = 读取信息请耐心等待 =
- echo =-----------------------------------------=
- echo.
- for /f "tokens=1 delims=[]" %%i in ('%SystemRoot%\system32\nbtstat -S^|find /n "以太网:"') do (
- nbtstat -S | more +%%i >$
- set /p Str=<$
- del $
- for /f "tokens=2 delims=[]" %%i in ('echo "!Str!"') do set LIP=%%i
- )
- for /f "tokens=1 delims=[]" %%i in ('%SystemRoot%\system32\nbtstat -S^|find /n "WLAN:"') do (
- nbtstat -S | more +%%i >$
- set /p Str=<$
- del $
- for /f "tokens=2 delims=[]" %%i in ('echo "!Str!"') do set WIP=%%i
- )
- for /f "tokens=16" %%i in ('ipconfig /all ^| find /i "IPv4 地址"') do set ip=%%i
- echo =================================================== >ip-mac.txt
- echo 当前时间:%DATE% >>ip-mac.txt
- echo =================================================== >>ip-mac.txt
- echo 本机用户名为:%COMPUTERNAME% >>ip-mac.txt
- echo =================================================== >>ip-mac.txt
- echo 本机有线IP为:%LIP% >>ip-mac.txt
- echo 本机无线IP为:%WIP% >>ip-mac.txt
- ::echo 本机首选IP为:%ip% >>ip-mac.txt
- echo 本机物理地址: >>ip-mac.txt
- echo ===================================================
- for /f "tokens=1,3 delims=," %%i in ('getmac /v /nh /fo:csv ^| findstr
- "..-..-..-..-..-.."') do (
- echo %%i %%j >>ip-mac.txt
- )
- echo =================================================== >>ip-mac.txt
- ipconfig | findstr /i "以太网 无线 IPv4">>ip-mac.txt
- echo =================================================== >>ip-mac.txt
- echo =====本机已安装软件信息=================================== >>ip-mac.txt
- echo =================================================== >>ip-mac.txt
- cd /d %~dp0
- for /f "tokens=7* delims=" %%i in ('reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall') do (
- echo 当前扫描信息: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%~i
- reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%~i" reg.$ >nul
- for /f "delims=" %%j in ('type reg.$ ^| findstr /i /c:"DisplayName" 2^>nul') do (
- set DN=%%~j
- set DN=!DN:"=!
- set !DN!
- )
- for /f "delims=" %%k in ('type reg.$ ^| findstr /i /c:"InstallLocation" 2^>nul') do (
- set IL=%%~k
- set IL=!IL:"=!
- set IL=!IL:\\=\!
- set !IL!
- )
- if not defined DisplayName set DisplayName=没有信息。
- if not defined InstallLocation set InstallLocation=没有信息。
- (echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- echo 注册表值: %%~i
- echo 软件名称: !DisplayName!
- echo 安装路径: !InstallLocation!
- echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- echo,)>>ip-mac.txt
- set DisplayName=&set InstallLocation=&del reg.$
- )
- Start ip-mac.txt
复制代码
|
|