Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for chmfixunc.bat

(view source code of chmfixunc.bat as plain text)

  1. @ECHO OFF
  2. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  3. IF NOT  "%~1"==""           GOTO Syntax
  4. REG.EXE Add /? 2>NUL | FIND /I " /ve " >NUL || GOTO Syntax
  5.  
  6. SETLOCAL ENABLEDELAYEDEXPANSION
  7. SET UNCList=
  8. FOR /F "tokens=3" %%A IN ('NET USE ^| FINDSTR "[A-Z]:"') DO (
  9. 	SET UNC=%%A
  10. 	SET UNC=!UNC:\=\\!
  11. 	SET UNCList=!UNCList!!UNC!;file://!UNC!;
  12. )
  13. IF DEFINED UNCList (
  14. 	ECHO.
  15. 	ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
  16. 	ECHO.
  17. 	REG Add   HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions /v MaxAllowedZone /t REG_DWORD /d         1 /f
  18. 	REG Query HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions /v MaxAllowedZone | FIND /I "MaxAllowedZone"
  19. 	ECHO.
  20. 	REG Add   HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions /v UrlAllowList   /t REG_SZ    /d %UNCList% /f
  21. 	REG Query HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions /v UrlAllowList   | FIND /I "UrlAllowList"
  22. )
  23. ENDLOCAL
  24. GOTO:EOF
  25.  
  26.  
  27. :Syntax
  28. ECHO.
  29. ECHO CHMFixUNC.bat,  Version 1.00 for Windows 7
  30. ECHO Allow *.chm files to be opened from all currently mapped network drives
  31. ECHO.
  32. ECHO Usage:  CHMFIXUNC
  33. ECHO.
  34. ECHO Note:   This bath file sets the following registry values:
  35. ECHO.
  36. ECHO         [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
  37. ECHO         "MaxAllowedZone"=dword:00000001
  38. ECHO         "UrlAllowList"="\\\\server1\\share1;file://\\\\server1\\share1;" etc.
  39. ECHO.
  40. ECHO Written by Rob van der Woude
  41. ECHO http://www.robvanderwoude.com
  42.  
  43. IF "%OS%"=="Windows_NT" EXIT /B 1
  44.  

page last modified: 2024-04-16; loaded in 0.0073 seconds