Windows does not offer an equivalent to Unix’ shebang, e.g. #!/usr/bin/perl -T, which is unfortunate. Instead, Windows users can register a default program with each file extension, that is invoked if the user double-clicks on a file or if a file is run from the Windows command prompt. This is less flexible because file-specific arguments to the invoked program, such as -T in my initial shebang example, cannot be stored alongside the file. Moreover, having to use a graphical interface to register programs with extensions doesn’t overly excite me.
However, since Windows 2000 there exists the – so far unknown to me – possibility of getting the task done via the shell utilities assoc and ftype:
$>assoc .scala=ScalaFile
.scala=ScalaFile
$>ftype ScalaFile=C:\Program Files\scala\bin\scala.bat -savecompiled %1 %*
ScalaFile=C:\Program Files\scala\bin\scala.bat -savecompiled %1 %*This still is less flexible than the shebang, but, well … everybody needs something that he/she is looking forward to see implemented in his/her favourite operating system, right?
Thanks to the folks at ActiveState for pointing this out.


