PoshCode Archive  Artifact Content

Artifact e1f6518172849f8cbde8a36bdc0e19aa3e0900b957db59e11dbb66eff9b3d262:

  • File Repost-from-http-forum-script-.ps1 — part of check-in [7b818072a9] at 2018-06-10 14:01:22 on branch trunk — Repost from http://forum.script-coding.com/viewtopic.php?id=10475 (user: unknown size: 1405)

# encoding: ascii
# api: powershell
# title: 
# description: Repost from http://forum.script-coding.com/viewtopic.php?id=10475
# version: 0.1
# license: CC0
# x-poshcode-id: 5786
# x-archived: 2016-03-05T22:25:15
#
#
@echo off
  setlocal enabledelayedexpansion
    set "key=HKLM\SOFTWARE\Microsoft\.NETFramework"
    for /f "skip=3 tokens=3" %%i in (
      '2^>nul reg query %key% /v InstallRoot'
    ) do set "root=%%i"
    if "%root%" equ "" (
      echo Probably .NET Framework has not been installed.
      goto:eof
    )
    if not exist "%root%" (
      echo Specified path of .NET Framework is invalid.
      goto:eof
    )
    set "key=HKLM\SOFTWARE\Microsoft\Fusion\GACChangeNotification\Default"
    set /a "num=0"
    echo The Global Assembly Cache contains the following assemblies:
    for /f "skip=4" %%i in (
      'reg query %key% ^| findstr /v /irc:"StoreChangeID"'
    ) do (
      for /f "tokens=1,2,3,4,5 delims=," %%j in ("%%i") do (
        set "clt=%%l"
        if "!clt:~2,1!" neq "" (
          set "clt=neutral"
          set "tok=%%l"
          set "arc=%%m"
        ) else (
          set "tok=%%m"
          set "arc=%%n"
        )
        echo   %%j, Version=%%k, Culture=!clt!, PublicKeyToken=!tok!, ProcessorArchitecture=!arc!
      )
      set /a "num+=1"
    )
    echo.
    echo Number of items = !num!
  endlocal
exit /b