r/Batch • • Nov 02 '26

Question (Unsolved) Which batch to exe software to use?

Hi all, long story short I have used bat2exe and windows defender is picking up as threat and removing it. Not sure if its the actual script or the software itself. Anyways, which batch to exe is safest and wont likely get flagged by antivirus? Thank you

2 Upvotes

20 comments sorted by

9

u/Shadow_Thief Nov 02 '26

All of the converters have been used maliciously enough in the past that they all get flagged by heuristic scanners.

1

u/pc1350 Nov 03 '26

Adding to what everybody wrote: see this: https://www.dostips.com/forum/viewtopic.php?p=28277#p28277

Dave Benham's masterpiece Colossal Cave Adventure in batch.

Snippet of obfuscated batch file:

cls
<nul set /p "=Initializing "

::{ Inevnoyr qrsvavgvbaf:
::
::  = znpeb qrsvavgvba
:: $kkkkk = fgngvp inyhr, hfhnyyl qrevirq sebz qngnonfr
:: #kkkkk = qlanzvp inyhr arrqrq sbe fnir svyrf
:: kkkkk = qlanzvp inyhr bs grzc vzcbegnapr
::
....and more....
::}
set @{zbir}=for %%. in (1 2) do if %%.==2 (for /f "tokens=1,2 delims= " %%1 in ("!args!") do (%\n%
  if %%1 lss 100 (%\n%
    set /a "{zbir.byqYbp}=#{bowCynpr}.%%1, #{bowCynpr}.%%1=%%2"%\n%
    for %%O in (!{zbir.byqYbp}!) do set "#{cynprBowf}.%%O=!#{cynprBowf}.%%O: %%1 = !"%\n%
    set "#{cynprBowf}.%%2= %%1!#{cynprBowf}.%%2!"%\n%
  ) else (%\n%
    set /a "{zbir.bow100}=%%1-100"%\n%
    set /a "{zbir.byqYbp}=#{bowSvkrq}.!{zbir.bow100}!, #{bowSvkrq}.!{zbir.bow100}!=%%2"%\n%
    for %%O in (!{zbir.byqYbp}!) do set "#{cynprBowf}.%%O=!#{cynprBowf}.%%O: %%1 = !"%\n%
    if %%2 gtr 0 set "#{cynprBowf}.%%2= %%1!#{cynprBowf}.%%2!"%\n%
  )%\n%
)) else set args=

1

u/Boorchu Nov 03 '26

Sorry for being newbie but what is this and how does it relate or help with my question? 😅

1

u/pc1350 Nov 03 '26

As I wrote: comments mention obfuscation of a batch file. So here is a real example and how it looks like.

1

u/BellaTheUni112 Nov 05 '26

don't use one. they're not good. you should write your program in a compiled language like c if you want an exe file.

1

u/Boorchu Nov 05 '26

I have no clue about programming or anything. Just have this batch only

3

u/capoapk Nov 02 '26

What is your script used for? There can be commands that are suspicious

2

u/BrainWaveCC Nov 02 '26

I've tested a bunch of them over the years, including last year.

I've never found a good reason to rely on one since they come with security drawbacks, like been flagged as malicious code more often than not.

0

u/stevesfara Nov 02 '26

i usually used converters to protect my code. but now i have a trick to encrypt my code using HxD, you have to add FF FE at the start of the file (Remember to ADD, NOT REPLACE) and if you then try to edit in notepad, your code will be encrypted.

2

u/Boorchu Nov 02 '26

Care to share how it works or is there an tutorial for this? That is what I am trying to do - protect my batch. Dont want people to see it by opening it with notepad.

4

u/ProCompSys Nov 02 '26 edited Nov 02 '26

Please note this is NOT encryption! At its best it's obfuscation. Just use a hex-editor to create/change the file-header/BOM to "FF FE". This way text-editors stumble over the text-encoding of the file and display gibberish. Execution of the batch-script does work nonetheless.  One who knows or guesses or recognizes the gibberish can easily revert by removing the added header from the file again.

For me, wrapping the batch in a self-extracting RAR- or ZIP-archive that starts the extracted batch-file worked for most cases... it's more or less exactly what bat2exe does. But also this approach extracts the readable script at some point during runtime; grabbing and looking at it in readable form isn't rocket-science.

To cut a long story short:  The is NO way to completely hide a batch-file from other's eyes... if you want closed source, you have to use other approaches than a batch-script.

3

u/BrainWaveCC Nov 02 '26

Dont want people to see it by opening it with notepad.

The script to exe converters are still going to deposit a clear text version of the script on the target machine at runtime. Some leave it in the temp folder, and some clean it up after execution, but it is trivial to recover while the script is running.

2

u/Shadow_Thief Nov 02 '26

It works by converting the text to UTF-16. Anybody with a hex editor will still be able to see your source code. If you want to hide your code, pick a language that actually compiles.

4

u/BrainWaveCC Nov 02 '26

your code will be encrypted.

The word you're looking for is obfuscated, and it is trivial to get direct access to the script again.

3

u/vip17 Nov 03 '26

any of such obfuscation method is extremely easy to revert. Game engines have far more complicated methods of obfuscation and yet they can still be c******. The OP really need to think about it differently, not obfuscating it this way

1

u/Glidepath22 Nov 03 '26

AI cuts through he encoding so fast it’s like not even there

1

u/Glidepath22 Nov 03 '26

I had a GTP created well little program I guess to call it trigger defender so I stopped in to look at the actual code and there was absolutely nothing harm on it not even remote possibility at least that I saw so I just don’t defend her to ignore it

1

u/FAMICOMASTER 20d ago

There used to be a tool a long time ago called Advanced Batch to EXE that I got some use out of for obfuscating code in some of my games (makes it harder to cheat).

That was over a decade ago so I don't know if it's still available or still useful or will work for your application. Best of luck.