here's what we have here:
Code: Select all
jscript/vbscript/whs/hta:
http://www.dostips.com/forum/viewtopic.php?f=3&t=5543&start=30
powershell:
http://www.dostips.com/forum/viewtopic.php?t=5526
.net
http://www.dostips.com/forum/viewtopic.php?t=5260
Some other techniques:
Code: Select all
autoit (search on the page for autoit) and kixtart:
http://www.robvanderwoude.com/clevertricks.php
seems to be popular for perl:
https://en.wikipedia.org/wiki/Polyglot_(computing)
java:
http://stackoverflow.com/questions/28190126/how-can-i-embed-java-code-into-batch-scriptis-it-possible-to-create-java-bat
this can be used for node.js/javascript/jscript:
https://gist.github.com/yaauie/959862
bash:
http://stackoverflow.com/questions/17510688/single-script-to-run-in-both-windows-batch-and-linux-bash
here's my attempt with python 2.7 (does not work with python 3)
Code: Select all
0<''' :label
@echo off
echo batch
python %~f0 %*
exit /b 0
'''
print "something"
for python 3.5 this can be used but it prints one redundant "&":
Code: Select all
0<0# :& @goto :python
'''
:python
@echo off
echo batch part
python %~f0 %*
exit /b 0
'''
print ("something")
ADSalways can be tried also..
XML based languages are easy here's an apache ant test:
Code: Select all
<!-- :
@echo off
echo batch message
call ant -f %~f0 %*
exit /b 0
-->
<project default="echo">
<target name="echo">
<echo message="ant message"/>
</target>
</project>
EDIT
Didn't pay enough attention to the siberia's man post.
This work for all python versions:
Code: Select all
0<0# : ^
'''
@echo off
echo batch
python %~f0 %*
exit /b 0
'''
print("something")