Microsoft Security Advisory 2963983

[Microsoft Security Advisory 2963983](https://technet.microsoft.com/library/security/2963983) を参考に、ざっくり vgx.dll を登録・解除するバッチファイルを書いてみました。 32-bit Windows のみ対応しています。64-bit Windows で動作させるにはレジストリキー（Wow6432Node）やフォルダー（C:\Windows\SysWOW64）などを考慮して修正する必要があります。

`where` コマンドがない場合は [which](http://qiita.com/kshibamo/items/a68c3d74cb8612f3017c) をご利用ください。

```bat:2963983.bat
@echo off

set SELF=%~n0

setlocal
  echo.
  echo checking prerequisites...
  set PATH=%PATH%;%PROGRAMFILES%\Internet Explorer
  for %%i in (iexplore.exe ping.exe reg.exe regsvr32.exe taskkill.exe tasklist.exe) do (
    where %%i > NUL || (
      (echo %SELF%: file not found: %%i) >&2
      exit /b 1
    )
  )
  call :sleep 2
  
  echo.
  echo creating VML file...
  (
    echo ^<html xmlns:v="urn:schemas-microsoft-com:vml"^>
    echo ^<head^>
    echo ^<style^>v\:* { behavior: url^(#default#VML^); }^</style^>
    echo ^</head^>
    echo ^<body^>
    echo ^<v:shape fillcolor="#ffcccc" strokecolor="#cfa3a7" style="width: 200; height:200" path="m 80,0 l 60,65, 0,65, 50,100, 25,160,80,120, 135,160, 110,100, 160,65 100,65 x e"^>^</v:shape^>
    echo ^</body^>
    echo ^</html^>
  ) > %SELF%.html
  
  echo.
  echo launching browser and drawing vector graphic...
  start iexplore %SELF%.html || (
    (echo %SELF%: launching browser failed: start) >&2
    exit /b 1
  )
  call :sleep 3
  
  echo.
  echo gathering information about vgx.dll...
  tasklist /M "vgx.dll" || (
    (echo %SELF%: gathering information failed: tasklist) >&2
    exit /b 1
  )
  
  echo.
  echo terminating browser...
  set /p t=press ^<ENTER^> to continue.
  for /f "tokens=2" %%i in ('tasklist /NH /FI "IMAGENAME eq iexplore.exe"') do (
    taskkill /PID %%i > NUL 2>&1 || (
      rem (echo %SELF%: terminating browser failed: taskkill) >&2
    )
  )
  
  reg query "HKEY_CLASSES_ROOT\CLSID\{10072CEC-8CC1-11D1-986E-00A0C955B42E}\InprocServer32" && (
    echo.
    echo deregistering vgx.dll...
    regsvr32 /u "%COMMONPROGRAMFILES%\Microsoft Shared\VGX\vgx.dll" || (
      (echo %SELF%: deregistering DLL failed: regsvr32) >&2
    )
  ) || (
    echo.
    echo registering vgx.dll...
    regsvr32    "%COMMONPROGRAMFILES%\Microsoft Shared\VGX\vgx.dll" || (
      (echo %SELF%: deregistering DLL failed: regsvr32) >&2
    )
  )
  
  echo.
  echo launching browser and drawing vector graphic...
  start iexplore %SELF%.html || (
    (echo %SELF%: launching browser failed: start) >&2
    exit /b 1
  )
  call :sleep 3
  
  echo.
  echo gathering information about vgx.dll...
  tasklist /M "vgx.dll" || (
    (echo %SELF%: gathering information failed: tasklist) >&2
    exit /b 1
  )
  
  echo.
  echo terminating browser...
  set /p t=press ^<ENTER^> to continue.
  for /f "tokens=2" %%i in ('tasklist /NH /FI "IMAGENAME eq iexplore.exe"') do (
    taskkill /PID %%i > NUL 2>&1 || (
      rem (echo %SELF%: terminating browser failed: taskkill) >&2
    )
  )
  
  echo.
  echo deleting temporary file...
  if exist "%SELF%.html" (
    del %SELF%.html > NUL || (
      (echo %SELF%: deleting file failed: del) >&2
      exit /b 1
    )
  )
  
  exit /b 0
endlocal
goto :EOF

:sleep
setlocal
  if "%~1" == "" (
    (echo insufficient argument: #1) >&2
    exit /b 1
  )
  ping -n %~1 127.0.0.1 > NUL 2>&1
endlocal
goto :EOF
```