Xsoc Posted August 17, 2020 Posted August 17, 2020 I wrote a simple script for both windows and linux, txt2ducky that will turn this @echo off @echo Super cool awesome batch file ipconfig into this STRING @echo off ENTER STRING @echo Super cool awesome batch file ENTER STRING ipconfig ENTER Nothing earth shattering, but I find it useful anyway. I'm sure it's been done before, but I couldn't find any examples soooo... whatever, here it is. Download Windows: txt2ducky.cmd Linux/etc: txt2ducky.sh Usage txt2ducky inputfile [outputfile] Roll Your Own If you want to use the code in another (batch file) project, all you really need is FOR /F "usebackq delims=" %%I IN ("%FILEIN%") DO ( @echo STRING %%I >> "%FILEOUT%" @echo ENTER >> "%FILEOUT%" ) or in a bash script, go for... while read -r line; do echo STRING $line >> $fileout echo ENTER >> $fileout done < $filein Just RegEx It! You can of course achieve the same thing was a simple RegEx find and replace... Find: .* Replace: STRING $0\nENTER Wrapping Up Hopefully someone else finds it useful. More details available on the GitHub Repo.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.