Scripting in D on Windows

Sergey Gromov snake.scaly at gmail.com
Thu Jan 29 16:47:07 PST 2009


It is possible to make .d files automatically executable on Windows.

For that you need:
1) modify the PATHEXT environment variable.  It's a semicolon-separated
list of executable extensions, so you just add ";.D" at the end
2) create a file association for .D and make the default action for it
of the form:

  dmd -run "%1" %*

Now if you have foo.d in your path, you just type 'foo' in command line
and it runs.

OK, so far so good.  But the drawback of this is that every single .d
file becomes executable which is absolutely not what I want.  I want
only selected, specially designed D programs to be executed when I
mention their name.  This would be possible if I used a different file
extension for D scripts, .ds for instance.  Unfortunately DMD chokes on
files with unknown extensions, making this impossible.

What do you think?  Would you use D for scripting?  Is it worth a
feature request for DMD to support additional--or arbitrary--extensions
for files executed with -run?



More information about the Digitalmars-d mailing list