{"id":41,"date":"2021-12-06T15:41:06","date_gmt":"2021-12-06T15:41:06","guid":{"rendered":"https:\/\/programs.lucas-elliott.com\/?p=41"},"modified":"2021-12-06T16:42:21","modified_gmt":"2021-12-06T16:42:21","slug":"in2batch-embed-files-in-batch-code","status":"publish","type":"post","link":"https:\/\/programs.lucas-elliott.com\/index.php\/2021\/12\/06\/in2batch-embed-files-in-batch-code\/","title":{"rendered":"In2Batch &#8211; Embed Files in Batch Code"},"content":{"rendered":"\n<p>Often, developers need to call files from within their scripts. Whether it\u2019s 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.<\/p>\n\n\n\n<p><strong>In2Batch<\/strong>&nbsp;works to solve this issue. By using the built in Windows tool called&nbsp;<em>certutil<\/em>, In2Batch converts any file into a batch script you can include within your batch file. Here\u2019s a video and a description of how it works:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"In2Batch by IT Command | A DeveloperTool for Storing Files in Batch Scripts\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/Ats89WrPK1Q?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><figcaption>In2Batch Example Video<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Using In2Batch<\/h3>\n\n\n\n<p>Let\u2019s say you want to include a small picture of a cat in your batch file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>call In2Batch.bat cat.png<\/code><\/pre>\n\n\n\n<p>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\u2019t, it creates it! You can put this script anywhere in your batch file as long as it runs before you might need the picture.<\/p>\n\n\n\n<p>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\u2019t 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\u2019s the help file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>This tool allows you to store any type of file inside your batch code.\n\nthe Syntax is:  \"In2Batch\"  FileName &#091;\/S] &#091;\/T] &#091;\/C]\n\nExample: \"In2Batch\" Icon.png\n         This example will create a text document with a batch script in it (and will open said text document).\n         copy that script into the top of your file (after '@echo off' if you have it), and when the batch file\n         starts, if Icon.png does not exist it will create it!\n\nthe \/S option does not open the file at the end of the conversion, and does not prompt for force.\nthe \/T option makes a script that creates your file in the temp folder. In our example above, it would\n         create Icon.png in the %temp% folder. Remember this when using said file later on!\n         Also note that files in %temp% do not get deleted automatically.\nthe \/C option copies the output to your clipboard. The output file will still be created, however.\n\nPlease note that this script uses a tool called AddEcho.exe. This lets us process many lines at once for the\n         echo process. It was written by TSnake41.\n\nExit Codes (errorlevels):\n          1=File Not Found\n          2=Could not create Required File Add2Echo\n          3=Process Failed for unknown reason.\n\nThis programs github page: https:\/\/github.com\/ITCMD\/Int2Batch\nOld Version 1 github page: https:\/\/github.com\/ITCMD\/Into-Batch\nVersion 1 does not use AddEcho.exe It is more stable but MUCH SLOWER and does not support large files.\nIn certain circumstances it may be better to use.\n\nQuestions or problems? Contact us at lucas_programming@itcommand.net!\n(C) 2019 by Lucas Elliott with IT Command www.itcommand.net\nThis program is free to use for personal or corporate circumstances, but removal of copyright information is illegal.<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\"><em>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.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-background has-black-background-color has-black-color is-style-wide\"\/>\n\n\n\n<h2 class=\"release-downloads-header\">Installer<\/h2><div class=\"release-description\"><p>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.<\/p><\/div><ul class=\"release-downloads\"><li><a href=\"https:\/\/github.com\/ITCMD\/In2Batch\/releases\/download\/INST-01\/In2Batch.Installer.bat\" rel=\"nofollow\"><strong class=\"release-name\">In2Batch.Installer.bat<\/strong> <small class=\"release-size\">33.18 KB<\/small> <small class=\"release-download-count\">157 downloads<\/small><\/a><\/li><li><a href=\"https:\/\/github.com\/ITCMD\/In2Batch\/archive\/INST-01.zip\" rel=\"nofollow\"><strong class=\"release-source\">Source code<\/strong><\/a><\/li><\/ul>\n\n\n\n<p> 157 recent downloads. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often, developers need to call files from within their scripts. Whether it\u2019s 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&nbsp;works to solve this issue. By using the built in Windows tool called&nbsp;certutil, In2Batch converts any file&#8230;<\/p>\n","protected":false},"author":1,"featured_media":47,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":7,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions\/53"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/media\/47"}],"wp:attachment":[{"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/programs.lucas-elliott.com\/index.php\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}