Reassociate .bat with cmd.exe

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Oct 18, 2009
102
4
#1
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,376
39
Albuquerque, NM
prospero.unm.edu
#2
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....
 
Oct 18, 2009
102
4
#6
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.
 
Oct 18, 2009
102
4
#7
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.