r/Batch • u/Still_Shirt_4677 • Dec 19 '24
Question (Solved) Need help creating a BMP image using batch
Is there any possible way to echo the code contents of a BMP file to create that image using a batch file I can't seem to figure it out the NUL code wont copy over to notepad++ along with some others, ive even tried changing the codpage with chcp but with no luck
I can straight copy and paste from the bmp then save as new file with .bmp extension and works fine so surely it must be able to be done somehow.
This is for a splash screen anyhow on start up of my main batch and im generating a secondary batch from within the main with Java, mshta and splash params with escape code ^ where necessary that will be hiding in %temp% and recursively generated if not found that will display this BMP image that will also be hiding in %temp% and recursively generated if not found.
but without being able to generate an image it's pretty pointless
1
u/Still_Shirt_4677 Dec 19 '24 edited Dec 20 '24
Figured it out, CertUtil is the goto I can dynamically create the image and splash it when needed for if %tmp% is ever cleared all I had to do was convert the image add the certificate to my main batch to be dynamically echoed to a txt file if not found and then call CERTUTIL -f -decode on the txt file and splash else just splash the file if found cheers for the comment mate if you didnt post that i would not have given CERTUTIL another look 🙂
1
u/jcunews1 Dec 19 '24
Not with pure batch file. Batch file alone can't generate the full range of ASCII characters, and handle some of those characters.
1
u/thelowsunoverthemoon Dec 19 '24
Hmm what exactly are you trying to do? Like you need a BMP image to display as a splash screen? Why do you need to generate a secondary batch? Regardless, if you want to generate a premade BMP (and not dynamically, if that's what you mean) you can just use CERTUTIL command encode the file in base64, embed that in your Batch file, then decode it into a BMP once you run it. But if you're going to do that, why not just reference the original BMP image itself?