Welcome!

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

SignUp Now!

Done Reassociate .bat with cmd.exe

Oct
364
17
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.
 
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....
 
And here's a somewhat fancier version.
 

Attachments

  • BatDefaults.btm
    1.2 KB · Views: 418
Updated to fix a problem with Edit, Print, and RunAs verbs.
 

Attachments

  • BatDefaults.btm
    1.8 KB · Views: 366
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.
 
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.
 
Back
Top