I have written a very simple (but I believe very useful) PowerShell script and created an installer for it in form of .cmd file. The distribution contains two .cmd files and two .ps1 files. Currently the installer downloads all required files from github.
My goal is to make the installer self-contained so people can use it even behind a strict firewall.
One approach could be like this:
echo param(>!filename!
echo [string] $pfilename>>!filename!
echo )>>!filename!
...
But this approach requires escaping special characters which may turn very complex. Besides, it needs to be automated somehow in order to be useful.
Another approach is to include the script souce code into the .cmd file directly, mark with comments like ::begin file1 and ::end file1 and then extract it. But how?
My first thought was to look into pl2bat. But it turned out that perl has a special switch (-x) which just strips off all text before the #!perl line, and the .bat file generated by pl2bat just runs perl -x on itself. So I can't use the same approach that pl2bat uses.
Any ideas?
PS: I know about NSIS, InnoSetup and WiX. I just want my installer to be text, not binary, so everyone can see that it is harmless.