1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reassociate .bat with cmd.exe

Discussion in 'Suggestions' started by Rick Reinckens, Jul 13, 2016.

  1. Rick Reinckens

    Joined:
    Oct 18, 2009
    Messages:
    96
    Likes Received:
    4
    TCC, etc., needs an easy way to reassociate .bat files with cmd.exe.

    I ran into a problem with a browser hijacker named Softrama. One of the tools to remove it is Junkware Removal Tool, JRT.exe. But when I run JRT it creates a .bat file and then can't run the file because it expects cmd.exe, not a third-party program.

    I tried reassociating .bat with cmd.exe, but "how to do it depends on who you ask." Everything I have seen involves all sorts of registry edits, frequently suggesting changes to keys that don't exist.

    I uninstalled TCMD but all that did was leave .bat files with no association.

    I tried using "open with other program" to reassociate .bat files but the "Always use this program" box is grayed out.

    Obviously there are times when companies need to re-purpose a computer or do other things (such as running malware removal software) , which could involve removing "specialty" software such as TCMD / TCC without having to reload Windows. There should be something equivalent to tccbatch.btm that reassociates .bat files.
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,300
    Likes Received:
    39
    Here's a quick hack:
    Code:
    @echo off
    assoc .bat=batfile
    assoc .cmd=cmdfile
    ftype batfile="%%1" %%*
    ftype cmdfile="%%1" %%*
    
    It doesn't fix any per-user associations. ASSOC /U and FTYPE /U are giving me strange error messages....
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,300
    Likes Received:
    39
    And here's a somewhat fancier version.
     

    Attached Files:

  4. keithg1964

    Joined:
    Jul 11, 2008
    Messages:
    49
    Likes Received:
    1
    Related note:
    I just found a good windows program to edit the Windows Default Menu.

    www.defaultprogramseditor.com

    It is an portable app.
    Not updated recently, but seems to work fine.

    Let me know if you have a better one.

    Keith
     
  5. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,300
    Likes Received:
    39
    Updated to fix a problem with Edit, Print, and RunAs verbs.
     

    Attached Files:

  6. Rick Reinckens

    Joined:
    Oct 18, 2009
    Messages:
    96
    Likes Received:
    4
    I haven't tried any of these but I did find a quirky way to fix this.

    Rex -- you need to contact MalwareBytes about this.

    If you run MalwareBytes, it will show that it has detected malware and this will be the result:

    Threat
    Broken.OpenCommand

    Category
    * Malware

    Type
    Registry Data

    Location

    HKCR\batfile\shell\open\command|

    If you remove the "malware", .bat files will open with cmd, not TCC.
     
  7. Rick Reinckens

    Joined:
    Oct 18, 2009
    Messages:
    96
    Likes Received:
    4
    INTERESTING! ...

    I'm running Take Command 18 and I just opened the Default Programs Editor and selected .bat files.

    For the Open command it shows:
    Program: Take Command
    Program Path: "C:\Program Files\JPSoft\TCMD18\tcmd.exe" /c "%1" %*​

    But for Run As Administrator it shows:
    Program: Windows Command Processor
    Program Path: C:\WINDOWS\System32\cmd.exe /C "%1" %*​

    So, apparently, running a .bat file as administrator avoids having to change the file association.
     

Share This Page