@echo off rem RegTweaks.btm 2010-03-03 C. Dye cdye@unm.edu rem rem Installs registry tweaks for 4NT or Take Command (whichever is rem running.) Version 7 or later is required. Available tweaks rem include adding the current shell to Explorer's drive and directory rem context menus, making the current shell the default handler for rem .BTM and (optionally) .BAT and .CMD files, adding the shell to rem the context menus for .BTM, .BAT and .CMD files, and adding the rem shell to AppPaths. rem Tedious preliminaries: if not 1 == 01 goto bad_version *if %@index[4NT!TCC!TCCLE!TCMD32!,%_cmdproc!] == -1 goto bad_version *if %_4ver lt 7 goto bad_version *setlocal *unalias * setdos /c254 /e94 /p36 /g., if %_4ver ge 9.01 option //expandpseudovariables=yes alias regcreate=`gosub regcreate` alias regset=`set value=%3$ %+ gosub regset %1 %2` alias regsetstr=`set value=%2$ %+ gosub regset %1 REG_SZ` alias regdelete=`gosub regdelete` alias abort=`echo. %+ echoerr %+ echoerr * %$ %+ echoerr * Aborting! %+ quit 1` set scriptver=2010-03-03 set shell=%@if[%_cmdproc == TCMD32,Take Command,%_cmdproc] set shortshell=%@if[%_cmdproc == TCMD32,TCmd,%_cmdproc] set major=%@int[%_4ver] set autodefaults= set filetype.btm=Take Command Batch File set filetype.bat=MS-DOS Batch File set filetype.cmd=Windows NT Command Script set newbtm=%windir\shellnew\new$.btm if %_4ver ge 10.0 .and. %shortshell == TCC .and. %_dosver ge 6.0 if %_elevated == 0 abort Requires admin rights; run as Administrator. if %_4ver == 9.0 if %_cmdproc == 4NT abort Is this a beta? if "%1" == "/undo" .or. "%1" == "-undo" .or. "%1" == "undo" goto undo if "%1" == "/auto" .or. "%1" == "-auto" .or. "%1" == "auto" set autodefaults=1 rem Determine whether we are running in TCI: set tci_flag= if "%shell" ne "4NT" goto no_tci if %_winver lt 5.1 goto no_tci if not defined tci goto no_tci if not exist "%tci" goto no_tci if "%@verinfo["%tci",ProductName]" ne "TCI" goto no_tci if "%@verinfo["%tci",FileDescription]" ne "Tabbed Console Interface" goto no_tci if "%@verinfo["%tci",CompanyName]" == "JP Software" set tci_flag=Y :no_tci rem Check for version 9+ of Take Command: set tcmd9= if "%shell" ne "TCC" .and. "%shell" ne "TCCLE" goto no_tcmd9 if %_4ver lt 9.0 goto no_tcmd9 if not exist "%@path[%_cmdspec]tcmd.exe" goto no_tcmd9 if "%shell" == "TCC" if "%@verinfo["%@path[%_cmdspec]tcmd.exe",FileDescription]" ne "Take Command" goto no_tcmd9 if "%shell" == "TCC" if "%@verinfo["%@path[%_cmdspec]tcmd.exe",CompanyName]" ne "JP Software" goto no_tcmd9 if %@filesize["%@path[%_cmdspec]tcmd.exe"] lt 1500000 goto no_tcmd9 set tcmd9="%@path[%_cmdspec]tcmd.exe" :no_tcmd9 rem Search for a few executables: gosub find_exe notepad.exe gosub find_exe reg.exe gosub find_exe cmd.exe rem Introductory information: echo. echo. echo RegTweaks %scriptver C. Dye %_batchname echo. echo This script will install several registry tweaks for %shell: echo. echo Add "%shell prompt here" to Drive and Directory context menus if defined tcmd9 echo Add "Take Command tab here" to Drive and Directory context menus echo Make %shell %_4ver the default handler for .BTM files echo Add "Run in %shell %_4ver" to the context menu for .BTM files echo Make %shell %_4ver the default handler for .BAT and .CMD files echo Add "Run in %shell %_4ver" to the context menu for .BAT and .CMD files echo Add %shell to AppPaths in the registry echo. iff "%shell" == "4NT" .and. %_winver ge 5.1 .and. "%tci_flag" == "" then echo TCI is not detected. If you use TCI, you should cancel now, and run echo this script in a 4NT shell running under TCI. Otherwise, the TCI- echo related tweaks will not be installed. echo. endiff echo All tweaks are optional, and you will be prompted for each. echos Do you want to continue? gosub prompt_user yes if "%yorn" == "n" abort Cancelled by user. rem Back up registry before beginning! gosub reg_backup rem Add "4NT prompt here" or "Take Command prompt here" items to rem Explorer's Drive and Directory context menus: echo %=n echo Do you want to add a "%shell prompt here" entry to Explorer's echos context menus for drives and directories? gosub prompt_user yes iff "%yorn" ne "n" then do object in /l Drive Directory echo Adding %shell %_4ver to Explorer's %object context menus: regcreate "HKCR\%object\shell\%shell\command" regsetstr "HKCR\%object\shell\%shell\" &%shell %_4ver prompt here regsetstr "HKCR\%object\shell\%shell\command\" "%_cmdspec" /k *cdd "{percent}1" iff "%shell" == "Take Command" then regdelete "HKCR\%object\shell\TCMD" endiff enddo endiff rem Add a "Take Command tab here" item to Explorer's Drive and rem Directory context menus: iff defined tcmd9 then echo %=n echo Do you want to add a "Take Command tab here" entry to Explorer's echos context menus for drives and directories? gosub prompt_user yes iff "%yorn" ne "n" then do object in /l Drive Directory echo Adding Take Command %_4ver to Explorer's %object context menus: regcreate "HKCR\%object\shell\Take Command\command" regsetstr "HKCR\%object\shell\Take Command\" Take Command %_4ver ta&b here regsetstr "HKCR\%object\shell\Take Command\command\" %tcmd9 /t "%_cmdspec" /k *cdd "{percent}1" regdelete "HKCR\%object\shell\TCMD" enddo echo %=n echo Also add a "CMD.EXE tab here" entry to Explorer's context menus for echos drives and directories? gosub prompt_user no iff "%yorn" == "y" then do object in /l Drive Directory echo Adding CMD.EXE tab to Explorer's %object context menus: regcreate "HKCR\%object\shell\TC-Cmd-tab\command" regsetstr "HKCR\%object\shell\TC-Cmd-tab\" CMD.EXE tab here regsetstr "HKCR\%object\shell\TC-Cmd-tab\command\" %tcmd9 /t "%cmd" /k cd /d "{percent}1" enddo endiff endiff endiff rem Add a "TCI tab here" item to Explorer's Drive and Directory context rem menus: iff "%tci_flag" == "y" then echo %=n echo Do you want to add a "TCI tab here" entry to Explorer's echos context menus for drives and directories? gosub prompt_user yes iff "%yorn" ne "n" then do object in /l Drive Directory echo Adding TCI (%shell %_4ver) to Explorer's %object context menus: regcreate "HKCR\%object\shell\TCI\command" regsetstr "HKCR\%object\shell\TCI\" TC&I tab here (4NT %_4ver) regsetstr "HKCR\%object\shell\TCI\command\" "%tci" /r "%_cmdspec" /k *cdd "{percent}1" enddo echo. echos Also add a context menu item for CMD.EXE in a TCI tab? gosub prompt_user no iff "%yorn" == "y" then do object in /l Drive Directory echo Adding TCI (CMD.EXE) to Explorer's %object context menus: regcreate "HKCR\%object\shell\TCI-Cmd\command" regsetstr "HKCR\%object\shell\TCI-Cmd\" TCI tab here (CMD.EXE) regsetstr "HKCR\%object\shell\TCI-Cmd\command\" "%tci" /r "%cmd" /k cd /d "{percent}1" enddo endiff endiff endiff rem Normally we want to make the current shell the default handler for rem .BTM files. But if the current shell is (the old) Take Command, and rem 4NT is already the default handler for .BTM files, we probably should rem not change the .BTM handler. Check for this special case: set default=Y if "%shell" ne "Take Command" goto skip set btm_handler=%@regquery[HKCR\.btm] if defined btm_handler if %btm_handler ne -1 set btm_handler=%@regquery[HKCR\%btm_handler\shell\open\command\] if defined btm_handler if %btm_handler ne -1 set btm_handler=%@word[0,%btm_handler] if not defined btm_handler goto skip if %btm_handler == -1 goto skip if not exist %btm_handler goto skip set verinfo=%@verinfo[%btm_handler,ProductName] if %@index[4NT!TCC!TCCLE!,%verinfo!] == -1 goto skip if "%@verinfo[%btm_handler]" ge "%@verinfo["%_cmdspec"]" set default=N :skip rem Make this shell the default handler for .BTM files: echo %=n echo Do you want to make %shell %_4ver the default handler for echos .BTM files? if "%default" == "N" echos (%verinfo is now the default handler.) gosub prompt_user %default iff "%yorn" == "y" then echo Associating .BTM files with %shell %_4ver: regcreate "HKCR\.btm" regsetstr "HKCR\.btm\" btmfile regcreate "HKCR\btmfile\shell\open\command" regsetstr "HKCR\btmfile\" %[filetype.btm] regsetstr "HKCR\btmfile\shell\open\command\" "%_cmdspec" /c "{percent}1" {percent}* rem Ensure that .BTM files have an Edit verb: iff "%@regquery[HKCR\btmfile\shell\edit\command\]" == "-1" then iff "%reg" ne "" .and. "%@regquery[HKCR\batfile\shell\edit\command\]" ne "-1" then reg.exe copy HKCR\batfile\shell\edit\command HKCR\btmfile\shell\edit\command /f > nul else regcreate "HKCR\btmfile\shell\edit\command" regsetstr "HKCR\btmfile\shell\edit\command\" "%notepad" "{percent}1" endiff regsetstr "HKCR\btmfile\shell\edit\" &Edit endiff rem Ensure that .BTM files have a Print verb: iff "%@regquery[HKCR\btmfile\shell\print\command\]" == "-1" then iff "%reg" ne "" .and. "%@regquery[HKCR\batfile\shell\print\command\]" ne "-1" then reg.exe copy HKCR\batfile\shell\print\command HKCR\btmfile\shell\print\command /f > nul else regcreate "HKCR\btmfile\shell\print\command" regsetstr "HKCR\btmfile\shell\print\command\" "%notepad" /p "{percent}1" endiff regsetstr "HKCR\btmfile\shell\print\" &Print endiff endiff rem Create a template .BTM file for ShellNew: echo %=n echos Do you want to create a .BTM file template? gosub prompt_user yes iff "%yorn" == "y" then echo Creating .BTM file template: (This change will take effect after echo the next restart.) regcreate "HKCR\.btm\ShellNew" regsetstr "HKCR\.btm\ShellNew\FileName" %newbtm iff not exist %newbtm then if not direxist %@path[%newbtm] md %@path[%newbtm] echo @echo off >! %newbtm echo setlocal >> %newbtm endiff endiff rem Add this shell to the context menu for .BTM files: iff "%@regquery[HKCR\.btm\]" == "btmfile" then echo %=n echo Do you want to add %shell %_4ver to the context menu for echos .BTM files? gosub prompt_user yes iff "%yorn" ne "n" then echo Adding %shell %_4ver to .BTM context menu: regcreate "HKCR\btmfile\shell\Run in %shell %major\command" regsetstr "HKCR\btmfile\" %[filetype.btm] regsetstr "HKCR\btmfile\shell\Run in %shell %major\" Run in &%shell %_4ver regsetstr "HKCR\btmfile\shell\Run in %shell %major\command\" "%_cmdspec" /c "{percent}1" {percent}* gosub add_debug_verb btmfile endiff endiff rem Add Take Command 9+ tab to the context menu for .BTM files: iff "%@regquery[HKCR\.btm\]" == "btmfile" .and. defined tcmd9 then echo %=n echo Do you want to add Take Command %_4ver to the context menu for echos .BTM files? gosub prompt_user yes iff "%yorn" ne "n" then echo Adding Take Command %_4ver to .BTM context menu: regcreate "HKCR\btmfile\shell\Run in Take Command %major\command" regsetstr "HKCR\btmfile\" %[filetype.btm] regsetstr "HKCR\btmfile\shell\Run in Take Command %major\" Run in Take Command %_4ver ta&b regsetstr "HKCR\btmfile\shell\Run in Take Command %major\command\" %tcmd9 /t "%_cmdspec" /k "{percent}1" endiff endiff rem Make this shell the default handler for .BAT and .CMD files: do ext in /l .BAT .CMD echo %=n echo Do you want to make %shell %_4ver the default handler for %ext echos files? (Not recommended!) gosub prompt_user no iff "%yorn" == "y" then set ftype=%@lower[%@right[-1,%ext]file] echo Associating %ext files with %shell %_4ver: regcreate "HKCR\%ext" regsetstr "HKCR\%ext\" %ftype regcreate "HKCR\%ftype\shell\open\command" regsetstr "HKCR\%ftype\" %[filetype%ext] regsetstr "HKCR\%ftype\shell\open\command\" "%_cmdspec" /c "{percent}1" {percent}* regcreate "HKCR\%ftype\shell\edit\command" regsetstr "HKCR\%ftype\shell\edit\" &Edit iff "%@regquery[HKCR\%ftype\shell\edit\command\]" == "-1" then regsetstr "HKCR\%ftype\shell\edit\command\" "%notepad" "{percent}1" endiff regcreate "HKCR\%ftype\shell\print\command" regsetstr "HKCR\%ftype\shell\print\" &Print iff "%@regquery[HKCR\%ftype\shell\print\command\]" == "-1" then regsetstr "HKCR\%ftype\shell\print\command\" "%notepad" /p "{percent}1" endiff regcreate "HKCR\%ftype\shell\Run in CMD.EXE\command" regsetstr "HKCR\%ftype\shell\Run in CMD.EXE\" Run in CMD.E&XE regsetstr "HKCR\%ftype\shell\Run in CMD.EXE\command\" "%cmd" /c "{percent}1" {percent}* else echo. echo Do you want to restore %ext files to Microsoft's default echos settings, so they will run in CMD.EXE? gosub prompt_user no iff "%yorn" == "y" then echo Restoring default settings for %ext files: gosub batch_defaults %ext endiff endiff enddo rem Add this shell to the context menu for .BAT and .CMD files: echo %=n echo Do you want to add %shell %_4ver to the context menu for echos .BAT and .CMD files? gosub prompt_user yes iff "%yorn" ne "n" then do ext in /l .bat .cmd set ftype=%@right[-1,%ext]file echo Adding %shell %_4ver to %@upper[%ext] context menu: regcreate "HKCR\%ext" regsetstr "HKCR\%ext\" %ftype regcreate "HKCR\%ftype\shell\Run in %shell %major\command" regsetstr "HKCR\%ftype\" %[filetype%ext] regsetstr "HKCR\%ftype\shell\Run in %shell %major\" Run in &%shell %_4ver regsetstr "HKCR\%ftype\shell\Run in %shell %major\command\" "%_cmdspec" /c "{percent}1" {percent}* gosub add_debug_verb %ftype enddo endiff rem Add Take Command 9+ tab to the context menu for .BAT and .CMD files: iff defined tcmd9 then echo %=n echo Do you want to add Take Command %_4ver to the context menu for echos .BAT and .CMD files? gosub prompt_user yes iff "%yorn" ne "n" then do ext in /l .bat .cmd set ftype=%@right[-1,%ext]file echo Adding Take Command %_4ver to %@upper[%ext] context menu: regcreate "HKCR\%ext" regsetstr "HKCR\%ext\" %ftype regcreate "HKCR\%ftype\shell\Run in Take Command %major\command" regsetstr "HKCR\%ftype\" %[filetype%ext] regsetstr "HKCR\%ftype\shell\Run in Take Command %major\" Run in Take Command %_4ver ta&b regsetstr "HKCR\%ftype\shell\Run in Take Command %major\command\" %tcmd9 /t "%_cmdspec" /k "{percent}1" enddo endiff endiff rem Add this shell to AppPaths in the registry: iff %@index[4nt.exe!tcmd.exe!tcc.exe!tccle.exe!,%@filename[%_cmdspec]!] ne -1 then echo %=n echos Do you want to add %_cmdspec to AppPaths? gosub prompt_user yes iff "%yorn" == "y" then echo Adding %_cmdspec to AppPaths: regcreate "HKLM\software\microsoft\windows\currentversion\app paths\%@filename[%_cmdspec]" regsetstr "HKLM\software\microsoft\windows\currentversion\app paths\%@filename[%_cmdspec]\" %_cmdspec endiff endiff rem Add Take Command 9+ to AppPaths in the registry: iff defined tcmd9 then echo %=n echos Do you want to add %tcmd9 to AppPaths? gosub prompt_user no iff "%yorn" == "y" then echo Adding %tcmd9 to AppPaths: regcreate "HKLM\software\microsoft\windows\currentversion\app paths\%@filename[%tcmd9]" regsetstr "HKLM\software\microsoft\windows\currentversion\app paths\%@filename[%tcmd9]\" %tcmd9 endiff endiff echo. echo Done. echo. endlocal quit :undo echo. echo. echo RegTweaks %scriptver C. Dye %_batchname echo. echo This will make lots of random changes to your registry and probably echo leave your system completely pooched. It will delete tons of info, echo including things which it never installed in the first place. There echo are no safety checks and no way to recover. Continuing is likely to echo be a Very Bad Idea. Why are you mucking about with undocumented echo options anyway? echo. echos Do you want to continue, sucker? gosub prompt_user no if "%yorn" ne "y" abort Cancelled by user. gosub reg_backup echo. echo Cleaning Explorer context menus: do product in /t"," /l 4NT,TCC,TCCLE,Take Command,TCmd,TCI,TCI-Cmd,TC-Cmd-tab set product=%@trim[%product] do object in /l Drive Directory iff %@regexist["HKCR\%object\shell\%product"] == 1 then echo Removing %product from context menus for %object: regdelete "HKCR\%object\shell\%product" endiff enddo enddo iff %@regexist["HKCR\.btm"] == 1 then echo. echo Removing .BTM file extension: set result=%@regdelkey["HKCR\.btm"] endiff do type in /l btmfile 4NT.Batch TCC.Batch TCMD.Batch iff %@regexist["HKCR\%type"] == 1 then echo. echo Removing %type file type: set result=%@regdelkey["HKCR\%type"] endiff enddo do type in /l BAT BTM CMD set ftype=JP Software.Take Command 9.0.%type iff %@regexist["HKCR\%ftype"] == 1 then echo Removing %ftype file type: set result=%@regdelkey["HKCR\%ftype"] endiff enddo echo. echo Restoring default settings for .BAT and .CMD files: gosub batch_defaults .BAT gosub batch_defaults .CMD echo. do ftype in /l batfile cmdfile do product in /t"," /l 4NT,TCC,TCCLE,Take Command,TCmd,CMD.EXE,COMMAND.COM,Debug,RunDebug set product=%@trim[%product] iff %@regexist["HKCR\%ftype\shell\Run in &%product"] == 1 then echo Removing "Run in &%product" from "%ftype" context menu: regdelete "HKCR\%ftype\shell\Run in &%product" endiff iff %@regexist["HKCR\%ftype\shell\Run in %product"] == 1 then echo Removing "Run in %product" from "%ftype" context menu: regdelete "HKCR\%ftype\shell\Run in %product" endiff iff %@regexist["HKCR\%ftype\shell\&%product"] == 1 then echo Removing "&%product" from "%ftype" context menu: regdelete "HKCR\%ftype\shell\&%product" endiff iff %@regexist["HKCR\%ftype\shell\%product"] == 1 then echo Removing "%product" from "%ftype" context menu: regdelete "HKCR\%ftype\shell\%product" endiff do ver = 6 to 12 iff %@regexist["HKCR\%ftype\shell\Run in &%product %ver"] == 1 then echo Removing "Run in &%product %ver" from "%ftype" context menu: regdelete "HKCR\%ftype\shell\Run in &%product %ver" endiff iff %@regexist["HKCR\%ftype\shell\Run in %product %ver"] == 1 then echo Removing "Run in %product %ver" from "%ftype" context menu: regdelete "HKCR\%ftype\shell\Run in %product %ver" endiff enddo enddo enddo echo. echo Removing JP Software shells from AppPaths in the registry: do product in /l 4NT.EXE TCC.EXE TCCLE.EXE TCMD.EXE regdelete "HKLM\software\microsoft\windows\currentversion\app paths\%product" enddo iff exist %newbtm then echo. echo Removing .BTM template file: del /q %newbtm endiff echo. echo Done. echo. endlocal quit :find_exe [filename] set %@name[%filename]= iff "%shell" == "TCCLE" then set i=%@execstr[which %filename] if "%@word[3,%i]" == "external" set %@name[%filename]=%@word[-0,%i] set i= else set %@name[%filename]=%@search[%filename] endiff return :batch_defaults [ext] rem Restore Microsoft's default settings for batch files: set ftype=%@lower[%@right[-1,%ext]file] regcreate "HKCR\%ext" regsetstr "HKCR\%ext\" %ftype regcreate "HKCR\%ftype\shell\open\command" regsetstr "HKCR\%ftype\" %[filetype%ext] regsetstr "HKCR\%ftype\shell\open\command\" "{percent}1" {percent}* regcreate "HKCR\%ftype\shell\edit\command" regsetstr "HKCR\%ftype\shell\edit\" regcreate "HKCR\%ftype\shell\print\command" regsetstr "HKCR\%ftype\shell\print\" regset "HKCR\%ftype\shell\edit\command\" REG_EXPAND_SZ {percent}SystemRoot{percent}\System32\NOTEPAD.EXE {percent}1 regset "HKCR\%ftype\shell\print\command\" REG_EXPAND_SZ {percent}SystemRoot{percent}\System32\NOTEPAD.EXE /p {percent}1 return :reg_backup echo. echos Do you want to back up the registry keys which will be altered? gosub prompt_user yes if "%yorn" == "n" return echos Creating backup: %=s set dir=%@path[%_batchname] set backupname=Backup %_isodate set n=0 do while exist "%dir%%backupname.reg" set n=%@inc[n] set backupname=Backup %_isodate (%n) enddo set backupname="%dir%%backupname.reg" set tempfile="%dir%$RegTweaks$Temp$.reg" set unicode_save=%@option[unicodeoutput] option //unicodeoutput=yes echo Windows Registry Editor Version 5.00 >! %backupname do regkey in /t"," /l HKCR\Drive\shell,HKCR\Directory\shell,HKCR\.btm,HKCR\.bat,HKCR\.cmd,HKCR\btmfile,HKCR\batfile,HKCR\cmdfile,HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\4nt.exe,HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\tcc.exe,HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\tcmd.exe set regkey=%@trim[%regkey] if "%@left[5,%regkey]" == "HKCR\" set regkey=HKEY_CLASSES_ROOT\%@right[-5,%regkey] if "%@left[5,%regkey]" == "HKLM\" set regkey=HKEY_LOCAL_MACHINE\%@right[-5,%regkey] echos . echo. >> %backupname echo [-%regkey] >> %backupname iff %@regexist["%regkey"] then del /e /q %tempfile regedit /e %tempfile "%regkey" ffind /+1 /k /v /m /t"%=r" %tempfile >> %backupname endiff enddo option //unicodeoutput=%unicode_save echo. echo Saved as %backupname del /e /q %tempfile return :prompt_user [default] set def=%@left[1,%default] if not defined def set def=n iff "%def" == "y" then echos ` [Y/n] ` else echos ` [y/N] ` endiff iff defined autodefaults then set yorn=%def else inkey /k"yn[enter]" /p /x %%yorn if "%yorn" == "@28" set yorn=%def endiff iff "%yorn" == "y" then echo Yes%=n else echo No endiff return :add_debug_verb [ftype] if "%ftype" == "" return if not isinternal bdebugger return set debugger=%@regquery["HKCR\%ftype\shell\Debug\command\JP shell version"] if %@words[%debugger] ne 2 goto adv2 set debugshell=%@word[-1,%debugger] set debugver=%@word[-0,%debugger] set debugtest=%@word[0,%@regquery["HKCR\%ftype\shell\Debug\command\"]] if not defined debugtest goto adv2 if "%debugtest" == "-1" goto adv2 if .%@ext[%debugtest] ne .exe goto adv2 if not exist %debugtest goto adv2 if %_4ver lt %debugver return if %_4ver == %debugver .and. "%shell" == "Take Command" .and. %debugshell == 4NT return :adv2 echo Adding Debug to .%@upper[%@left[3,%ftype]] context menu: regcreate "HKCR\%ftype\shell\Debug\command" regsetstr "HKCR\%ftype\shell\Debug\" Debu&g regsetstr "HKCR\%ftype\shell\Debug\command\" "%_cmdspec" /c bdebugger "{percent}1" {percent}* regsetstr "HKCR\%ftype\shell\Debug\command\JP shell version" %shortshell %_4ver unset /q debugshell debugver debugtest return :regcreate [name] set result=%@regcreate[%name] if %result == 0 return abort Error %result creating registry key %name :regset [name type] if not defined value if %@regquery[%name] == -1 ( set result=0 %+ return ) set result=%@regset[%name,%type,%@replace[{percent},%%%%,%value]] if %result == 0 return abort Error %result setting registry item %name to %type = %value :regdelete [name] if %@len[%name] lt 16 abort Whoa, Nellie! iff %@regexist[%name] == 0 then set result=0 else set result=%@regdelkey[%name] return :bad_version echo. echo * Sorry; this script requires 4NT or Take Command version 7 or later. echo * Aborting! if 1.0 == 01 quit 1 goto :eof Updates: 2007-04-23 Original release. 2008-01-04 Fixes an error in the context menus for .BAT and .CMD files. 2008-02-08 Adds support for Take Command 9. Adds a Debug verb to context menus for batch files. Reworks the backup routine; now the backup .REG will delete the relevant keys before recreating them (if applicable.) Removes support for 4NT/TCmd version 6, and therefore Windows 95/98/Me. 2008-04-25 Initial support for TCC/LE. 2008-05-21 Released version of TCC/LE does not support @SEARCH. 2009-02-06 Default AppPaths tweak to Yes. If Take Command 10.0+ and Windows Vista or later, check _elevated. 2009-02-26 Fix JP shell sanity check to allow other decimal separators. 2009-10-14 Changes the description for BTM files to "Take Command Batch File", and creates a template file for ShellNew. Adds a "CMD.EXE tab here" option for Take Command 9+. 2009-11-19 Creates %windir\ShellNew if it doesn't already exist. 2010-03-03 Fixed *another* shell check which incorrectly assumed the U.S. decimal separator.