Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for rxassoc.bat

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

  1. @ECHO OFF
  2. :: RxAssoc.bat,  Version 2.00 for Windows NT
  3. :: Define a file type and association for Rexx scripts and add
  4. :: the .REX extension to the environment variable PATHEXT.
  5. :: Written by Rob van der Woude
  6. ::
  9. ECHO.
  10. ASSOC .rex=ReginaRexxScript
  11. FTYPE ReginaRexxScript=REGINA.EXE %%1 %%*
  12. SET Added=0
  13. FOR %%A IN (%PathExt%) DO IF /I "%%A"==".REX" SET Added=1
  14. IF "%Added%"=="0" SET PATHEXT=%PATHEXT%;.REX
  15. (ECHO REGEDIT4)>%Temp%.\RxAssoc.reg
  16. (ECHO.)>>%Temp%.\RxAssoc.reg
  17. (ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment])>>%Temp%.\RxAssoc.reg
  18. (ECHO "PATHEXT"="%PathExt%")>>%Temp%.\RxAssoc.reg
  19. REGEDIT /S %Temp%.\RxAssoc.reg
  20. DEL %Temp%.\RxAssoc.reg
  21. ECHO.
  22. ECHO The .REX extension has been added to the environment variable PATHEXT.
  23. ECHO This means you no longer have to type the .REX extension to start the
  24. ECHO Rexx script, just like typing COMMAND is enough to start COMMAND.COM.
  25. ECHO However, since PATHEXT is a HKEY_LOCAL_MACHINE registry setting this
  26. ECHO change won't take effect until you reboot the system.

page last modified: 2023-03-10