Often, developers need to call files from within their scripts. Whether it’s an executable, settings file, or even another batch file, it can be frustrating to have to include a bunch of files whenever you send your script.
In2Batch works to solve this issue. By using the built in Windows tool called certutil, In2Batch converts any file into a batch script you can include within your batch file. Here’s a video and a description of how it works:
Using In2Batch
Let’s say you want to include a small picture of a cat in your batch file:
call In2Batch.bat cat.png
This will create and open a text file with your batch script. This script checks to see if the file exists, and if it doesn’t, it creates it! You can put this script anywhere in your batch file as long as it runs before you might need the picture.
There are a couple of other parameters you can play with. You can perform the conversion silently (useful if you are using this tool in a script) so that it doesn’t display the completed script. You can also make a script that puts the file in your %temp% folder instead of your current directory, and finally, you can copy the completed script to your clipboard. Here’s the help file:
This tool allows you to store any type of file inside your batch code.
the Syntax is: "In2Batch" FileName [/S] [/T] [/C]
Example: "In2Batch" Icon.png
This example will create a text document with a batch script in it (and will open said text document).
copy that script into the top of your file (after '@echo off' if you have it), and when the batch file
starts, if Icon.png does not exist it will create it!
the /S option does not open the file at the end of the conversion, and does not prompt for force.
the /T option makes a script that creates your file in the temp folder. In our example above, it would
create Icon.png in the %temp% folder. Remember this when using said file later on!
Also note that files in %temp% do not get deleted automatically.
the /C option copies the output to your clipboard. The output file will still be created, however.
Please note that this script uses a tool called AddEcho.exe. This lets us process many lines at once for the
echo process. It was written by TSnake41.
Exit Codes (errorlevels):
1=File Not Found
2=Could not create Required File Add2Echo
3=Process Failed for unknown reason.
This programs github page: https://github.com/ITCMD/Int2Batch
Old Version 1 github page: https://github.com/ITCMD/Into-Batch
Version 1 does not use AddEcho.exe It is more stable but MUCH SLOWER and does not support large files.
In certain circumstances it may be better to use.
Questions or problems? Contact us at lucas_programming@itcommand.net!
(C) 2019 by Lucas Elliott with IT Command www.itcommand.net
This program is free to use for personal or corporate circumstances, but removal of copyright information is illegal.
Note: In2Batch uses a portable executable called Addecho.exe. The executable adds new lines much faster than batch could. The program was custom made and checked to make sure it was 100% clean. Generated scripts do not use this tool.
Installer
This will install the latest version of In2Batch.bat. You have the option to put it in your system32 folder, or to create a portable file you can use anywhere.
117 recent downloads.