Welcome!

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

SignUp Now!

BTM2EXE: TCC runtime + BTM as a single executable

Aug
376
9
If you have a Take Command .BTM script you want to run/distribute with the TCC runtime, it is possible to do so with a single executable file.

The attached script will create a self extracting executable (files will be extracted to %TEMP%) that runs your .btm script with TCC Runtime. When the script ends, it will remove all the "installed" files on %TEMP%.

Here are the steps:
  • Download TCC RT
  • Execute:
    Code:
    tcc-rt20.exe /extract     (or whatever version is current)
  • Go to the newly created subfolder (for Tcc-rt20 it is 550BB8A)
  • Decide if you want to build a 32-bit or 64-bit version
  • 32-bit: copy or move all the files in the 32-bit folder to the current folder (and thus overwrite the 64-bit version)
  • 64-bit: remove the 32-bit folder
  • Add your "YourScript.btm"
  • Create TCMD.INI, TCSTART.btm, TCEXIT.BTM if needed
  • Test your package: TCC.exe YourScript.btm
  • Remove unnecessary files. The minimum is:
    • English.dll
    • ipworks9.dll
    • ipworksbt1.dll
    • ipworksssh9.dll
    • ipworksssl9.dll
    • ipworksssnmp9.dll (not mandatory in 64-bit, btw)
    • ipworkszip9.dll
    • Lua53.dll
    • Onig.dll
    • takecmd.dll
    • tcc.exe
    • YourScript.btm
  • Test your package again
  • Add BTM2EXE.btm
  • Run command:
    Code:
    TCC.EXE BTM2EXE.BTM YourScript.btm
    (Yes, this is the TCC runtime executable; Take Command is not needed per sé )
  • Browse to subfolder DONE
  • Start YourScript.exe to test if everything works as expected.
  • You can now distribute YourScript.exe.

The BTM2EXE script makes use of IExpress.exe. It is in every Windows version since at least Win98, maybe even Win95. Not sure; too long ago .... The use of long filenames (LFN's) is optional, that's how old it is! :-)
It was used to deploy Internet Explorer (hence the name). It created a self extracting executable and fired the setup command after that. In this case we abuse this to start our script instead of the setup.exe.
The BTM2EXE script creates a "command-file" for IExpress with all the necessary settings and after that starts IExpress to let it do it's thing.

Some remarks
  • In my (rather simple) case it created a .EXE with a size of < 2.5 MB)
  • This script does the most things unattended. If you want to create your own and go through all the dialogs, you can start IEXpress without parameters (or IExpress filename.SED to have a starting point. Don't use "" with filename.SED. IExpress is allergic ;-)
  • There are other tools to create SFX files that run an executable, but the one i tested all trigger the UAC prompt. This one doesn't
  • The first time I ran the script, it failed. It left a .DDF file in the folder.
    Reason was that MakeCAB.exe wasn't "awake".
    MakeCAB is used to create the embedded .CAB file. Run MakeCAB.exe /F filename.DDF to wake up MakeCAB .... (and delete the debris afterwards). After that these problems were gone.
  • Although BATCOMP isn't included in TCC-RT, you still can compress/encrypt YourScript.btm with a "regular" TCMD. TCC-RT has no problem running it.
  • There will probably be an option to change the icon. I didn't look for it.
  • In TaskManager you will see 2 processes running: the freshly created executable and TCC.exe. In the applications-view you will only see TCC.exe:
TaskMgrProcess.JPG
TaskMgrApps.JPG
 

Attachments

  • TaskMgrApps.JPG
    TaskMgrApps.JPG
    45.7 KB · Views: 324
  • TaskMgrProcess.JPG
    TaskMgrProcess.JPG
    80.5 KB · Views: 313
  • Btm2exe.btm
    4.4 KB · Views: 335
Last edited:

Similar threads

Back
Top