How do I make exe with bat files

Page 1 of 2 12 LastLast

  1. Posts : 58
    Windows 10 LTSC
       #1

    How do I make exe with bat files


    I don't just want to convert a bat file into an exe. I have a bat file with calls to other files including .reg files. I would like to convert the whole thing into an .exe with calls for admin privileges. I'm hopping this will be the start of me making simple but effective tools for administrators.
      My Computer

  2.   My Computer


  3. Posts : 1,694
    Windows 10
       #3
      My Computer


  4. Posts : 5,492
    Windows 11 Pro 64-bit
       #4

    You will have lots of problem because of false-positive antivirus detection when you convert batch script to executable file.
      My Computer


  5. Posts : 58
    Windows 10 LTSC
    Thread Starter
       #5

    SIW2 said:
    7-zip SFX
    Thanks but that looks like an installer, I just want the exe to run simple code. Like those portable exe.
      My Computer


  6. Posts : 1,694
    Windows 10
       #6

    That is how you do by making a self extracting archive.

    What happens is it will bundle the bat into the exe and then when you run that exe it will extract the bat file seamlessly to the temp folder and then run it. The user won't even know and if the bat file has the hidden flag in it the user won't even know that it ran even though it did.

    All of those links provided will achieve what you are asking, all though Iexpress is native to windows and resides in /system32 folder so you can do this on windows natively.

    Outside of that you would need to compile the bat file using .net or something else like this. Iexpress or 7zip is just easy quick middle ground and achieves your outcome, where the temp extracted file will be cleaned up automatically and is seemless to the user.
      My Computer


  7. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #7

    Hello @Mintmag,

    Funny enough, I looked into this earlier in the year to apply to a program that I wrote for this Forum.

    I managed to find code to convert Batch to EXE, I think it was on Stackoverflow. The problem with that was the conversion produced a long string of letters and numbers that was totally unreadable, although the EXE file ran without problems and produced the correct results

    I also found a FREE standalone EXE Utility > BAT to EXE Converter that worked.

    I also found this FREE standalone EXE Utility > Advanced BAT to EXE Converter that worked.

    On ALL the above, when checked with VirusTotal they were flagged by some Anti-Virus software as failures [ between 7 and 10 ].

    I think that you would probably need a more professional conversion method, which I would assume comes at a cost.

    Alternatively, there are online tools that can also achieve this for you.

    I hope this helps.
      My Computer


  8. Posts : 27
    Windows 10
       #8

    I was having problems running batch files so I decided to rename the file .cmd and see if it would execute. I added the required "setlocal EnableDelayedExpansion" to the top of the new .cmd file but it displayed a "privileges" error.

    I have copies of numerous programs that convert BAT to EXE, but most require multiple inputs and options to generate an EXE file. For something simple, I wanted a way to convert a simple BAT to EXE without having to select multiple options and configurations.

    I did some research and located on OLD 7zip utility that provided a clean, simple and quick method of converting a simple .bat or .cmd file to an EXE. The old, outdated and unsupported utility is called "7z SFX CREATOR". I discovered that the utility only requires THREE files and two of the outdated 7zip program files that it includes (7z.dll and 7zG.exe) can be easily updated to the latest 7zip versions.

    This little utility creates good EXE files from .bat or .cmd and requires only THREE options: the SOURCE file, the TARGET file and the TYPE of output: installer(run a file) or archive (dont run a file).

    Since EXE files automatically run with privileges-the EXE I created worked perfectly.

    Clean, simple, uncomplicated and efficient. That's all I wanted in a BAT to EXE utility.
      My Computer


  9. Posts : 17,086
    Windows 10 Home x64 Version 22H2 Build 19045.4894
       #9

    Mintmag said:
    I don't just want to convert a bat file into an exe. I have a bat file with calls to other files including .reg files. I would like to convert the whole thing into an .exe with calls for admin privileges. I'm hopping this will be the start of me making simple but effective tools for administrators.
    Then don't bother making anything into an exe. It brings no advantage.

    As malneb pointed out, those bat2exe conversions just extract & run the bat when you run the exe. So nothing is actually achieved.

    In your particular case, you would have to re-write your .reg files into reg commands to incorporate into your batch files first.
    Reg - SS64
    Reg - MSLearn
    You might well decide it is worthwhile doing this even if you abandon the plan of converting to exe files.


    Best of luck,
    Denis
      My Computer


  10. Posts : 1,694
    Windows 10
       #10

    Another way to do this would be to make a proper application using any net language where you can stream the commands you could make a gui pretty easily and then it would be its own self contained application.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 23:00.
Find Us




Windows 10 Forums