- @echo off&setlocal enabledelayedexpansion
- (set uninsRoot=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall)
- (set _skip=0)
- for /f "delims=" %%z in ('reg query !uninsRoot! /s ^| findstr /i "displayname uninstallstring"') do (
- (set _F=%%z)&(set QUSP=!_F!)&(set nameP=!_F!)&(set sp_rjgxP=!_F!)&(set sp_gxP=!_F!)&(set usP=!_F!)
- (set nameP=!nameP:DisplayName=!)&(set usP=!usP:UninstallString=!)&(set QUSP=!QUSP:QuietUninstallString=!)
- (set sp_rjgxP=!sp_rjgxP:软件更新=!)&(set sp_gxP=!sp_gxP:(KB=!)
-
- if "!_F!" neq "!nameP!" (
- (set _skip=0)
- if "!_F!" neq "!sp_rjgxP!" (set _skip=1)
- if "!_F!" neq "!sp_gxP!" (set _skip=1)
- )
-
- if !_skip! equ 0 if "!_F!" equ "!QUSP!" ( rem 跳过 QuietUninstallString
- (set line=%%z)&(set line=!line:*REG_SZ=!)&(set line=!line:*REG_EXPAND_SZ=!)&(set line=!line:~1!)
- if "!_F!" neq "!nameP!" (echo.)&echo !line!
-
- if "!usP!" neq "!_F!" (
- for /f "delims=" %%B in ("!line!") do (
- (set softdir=%%~sdpB)
- if exist !softdir!nul (
- for /f "delims=" %%l in ('dir "%%~dpB" /a-d /s /-c ^| findstr "个文件"') do (
- for /f "tokens=3 delims= " %%a in ("%%l") do (set size=%%a)
- )
- set /a "size=(size+1048576/2)/1048576"
- echo %%~dpB !size!MB %%~tB
- )
- )
- )
- )
- )
- pause
复制代码 以上代码可以部分正确的获取应用软件的位置, 大小, 相关时间, 要更完全的解决问题需要对注册表更复杂全面的分析, 甚至其它更好的途径
以下是代码测试输出的部分结果:360杀毒
C:\Program Files\360\360sd\ 230MB 2009-11-30 下午 19:22
Adobe Flash Player 10 ActiveX
C:\WINDOWS\system32\Macromed\Flash\ 16MB 2010-02-25 下午 22:08
Adobe Flash Player 10 Plugin
C:\WINDOWS\system32\Macromed\Flash\ 16MB 2010-02-17 下午 13:53
AutoIt v3.3.6.0
C:\Program Files\AutoIt3\ 22MB 2010-03-26 下午 15:38
百度Hi
C:\Program Files\baidu\Baidu Hi\ 39MB 2010-02-24 下午 14:12
Conexant HD Audio
C:\Program Files\CONEXANT\CNXT_AUDIO_HDA\ 1MB
HDAUDIO Soft Data Fax Modem with SmartCP
C:\Program Files\CONEXANT\CNXT_MODEM_HDA_HSF\ 1MB
[ 本帖最后由 neorobin 于 2010-3-30 17:36 编辑 ] |