Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Can't right-click a BTM

Jul
325
1
If I double-click a btm file that is in the root folder (C:\) it runs fine. But if I right-click and try to run same as administrator, I get an error:

This file does not have an app associated with it for performing this action.

Why? How do I fix this?
 
Sounds like your administrator account is a completely different one than your non-administrator one. Run TCC as administrator, change to the install folder, and then run the BTM file that sets up the file associations, which will apply them to that account. Or log into Windows as that administrator and then run the association BTM file.
 
I tried running tccbatch, and it ran and said it set the associations, but I got the same error when I tried right-clicking again.
 
The last time I looked, TCCBATCH does not set a RunAs verb. Would be a good feature to add, though.
 
Not tested, but try something like this from an elevated TCC:

Code:
set assoc=%@assoc[.btm]
echo %@regcreate[HKCR\%assoc\shell\runas\command]
echo %@regset[HKCR\%assoc\shell\runas\command\,REG_SZ,"%_cmdspec" /C "%%1" %%*]
 
Code:
@echo off
rem  TCMDHere.btm
rem  This batch file adds the "TCMD prompt here" entry to Windows Explorer
rem  RunAs mods 2014-06-29 CED

setlocal

  iff %_elevated == 0 then
    start /elevated /c %0 %1
    quit
  endiff

  echo.
  iff "%1" == "/U" then
    echos Do you want to remove TCMD from Windows Explorer, inc. RunAs[Y/N] ?
    inkey /k"yn[enter]" %%var
    iff "%var" eq "y" then
      :: is this corect ?
      echo %@regdelkey["HKCR\Directory\Shell\RunAs\command"] > nul
      echo %@regdelkey["HKCR\Directory\Shell\TCMD\command"] > nul
      echo %@regdelkey["HKCR\Drive\Shell\RunAs\command"] > nul
      echo %@regdelkey["HKCR\Drive\Shell\TCMD\command"] > nul
    endiff
    quit
  endiff

  setdos /c0xff00

  iff %_dosver ge 6.0 then
      echo If you are running Windows 8, 7, 2008, or Vista, you must first start a TCC
      echo session as an administrator (right click on the TCC icon and select "Run as
      echo administrator") and then run TCMDHere.btm in that session.
  endiff

  echo.
  echo Do you want to add a "TCMD prompt here" entry to the Windows Explorer
  echos context (right click) menus for directories and drives [Y/N] ?  ``
  inkey /k"yn[enter]" %%var

  if "%var" ne "y" quit 3

  echo %@regcreate["HKCR\Directory\Shell\TCMD\command"] > nul
  echo %@regcreate["HKCR\Drive\Shell\TCMD\command"] > nul

  iff %@regset["HKCR\Directory\Shell\TCMD\",REG_SZ,TCMD &prompt here] != 0 then
      echoerr Cannot update registry key!
      quit 2
  endiff

  echo %@regset["HKCR\Drive\Shell\TCMD\",REG_SZ,TCMD &prompt here] > nul

  echo %@regset["HKCR\Directory\Shell\TCMD\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul
  echo %@regset["HKCR\Drive\Shell\TCMD\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul

  rem Add RunAs verb to run TCMD.exe as Administrator -------------------------------------

  iff %_dosver ge 6.0 then
      echo %@regcreate["HKCR\Directory\Shell\RunAs\command"] > nul
      echo %@regcreate["HKCR\Drive\Shell\RunAs\command"] > nul

      iff %@regset["HKCR\Directory\Shell\RunAs\",REG_SZ,TCMD prompt here (&Admin)] != 0 then
          echoerr Cannot update registry key!
          quit 2
      endiff

      echo %@regset["HKCR\Drive\Shell\RunAs\",REG_SZ,TCMD prompt here (&Admin)] > nul

      echo %@regset["HKCR\Directory\Shell\RunAs\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul
      echo %@regset["HKCR\Drive\Shell\RunAs\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul
  endiff

  echo.
  echo The Windows Explorer context menus have been updated.

endlocal
 
Code:
@echo off
rem  TCMDHere.btm
rem  This batch file adds the "TCMD prompt here" entry to Windows Explorer
rem  RunAs mods 2014-06-29 CED

setlocal

  iff %_elevated == 0 then
    start /elevated /c %0 %1
    quit
  endiff

  echo.
  iff "%1" == "/U" then
    echos Do you want to remove TCMD from Windows Explorer, inc. RunAs[Y/N] ?
    inkey /k"yn[enter]" %%var
    iff "%var" eq "y" then
      :: is this corect ?
      echo %@regdelkey["HKCR\Directory\Shell\RunAs\command"] > nul
      echo %@regdelkey["HKCR\Directory\Shell\TCMD\command"] > nul
      echo %@regdelkey["HKCR\Drive\Shell\RunAs\command"] > nul
      echo %@regdelkey["HKCR\Drive\Shell\TCMD\command"] > nul
    endiff
    quit
  endiff

  setdos /c0xff00

  iff %_dosver ge 6.0 then
      echo If you are running Windows 8, 7, 2008, or Vista, you must first start a TCC
      echo session as an administrator (right click on the TCC icon and select "Run as
      echo administrator") and then run TCMDHere.btm in that session.
  endiff

  echo.
  echo Do you want to add a "TCMD prompt here" entry to the Windows Explorer
  echos context (right click) menus for directories and drives [Y/N] ?  ``
  inkey /k"yn[enter]" %%var

  if "%var" ne "y" quit 3

  echo %@regcreate["HKCR\Directory\Shell\TCMD\command"] > nul
  echo %@regcreate["HKCR\Drive\Shell\TCMD\command"] > nul

  iff %@regset["HKCR\Directory\Shell\TCMD\",REG_SZ,TCMD &prompt here] != 0 then
      echoerr Cannot update registry key!
      quit 2
  endiff

  echo %@regset["HKCR\Drive\Shell\TCMD\",REG_SZ,TCMD &prompt here] > nul

  echo %@regset["HKCR\Directory\Shell\TCMD\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul
  echo %@regset["HKCR\Drive\Shell\TCMD\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul

  rem Add RunAs verb to run TCMD.exe as Administrator -------------------------------------

  iff %_dosver ge 6.0 then
      echo %@regcreate["HKCR\Directory\Shell\RunAs\command"] > nul
      echo %@regcreate["HKCR\Drive\Shell\RunAs\command"] > nul

      iff %@regset["HKCR\Directory\Shell\RunAs\",REG_SZ,TCMD prompt here (&Admin)] != 0 then
          echoerr Cannot update registry key!
          quit 2
      endiff

      echo %@regset["HKCR\Drive\Shell\RunAs\",REG_SZ,TCMD prompt here (&Admin)] > nul

      echo %@regset["HKCR\Directory\Shell\RunAs\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul
      echo %@regset["HKCR\Drive\Shell\RunAs\command\",REG_SZ,"%@path[%_cmdspec]tcmd.exe" /D "%%L"] > nul
  endiff

  echo.
  echo The Windows Explorer context menus have been updated.

endlocal

One just needs to change tcmd.exe to tcc.exe in the inline TCMDHere.btm...

It will also be sure you are running it as administrator...
 
Back
Top
[FOX] Ultimate Translator
Translate