Run elixir -S script.exs with relative path

I’m trying to run a simple exs script from the command line, and it seems I have to have the full path to the file to make it work.
Is it possible to run elixir -S test.exs where test.exs is in the current directory? or do I always have to have the full path?
I’ve also tried elixir -S ./test.exs and that doesn’t work either.
I always get the error: -S : Could not find executable test.exs

I would like to use a script to run some simple file system commands cross-platform, but if I have to specify a full path, then this idea is already not cross-platform.

Environments:

Windows:
    Erlang/OTP 21 [erts-10.3] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]
    Elixir 1.10.0 (compiled with Erlang/OTP 21)                                   
WSL:
    Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
    Elixir 1.10.2 (compiled with Erlang/OTP 22)

Actually it doesn’t appear to work on Windows even with a full path.
<sigh> It would be nice if Elixir Windows support wasn’t just an afterthought.

Drop the -S.

-S is explicitely designed to resolve the script name from PATH. At least this is how I understand its entry in elixir --help.

2 Likes

Of course elixir test.exs without the -S works.
Thanks for helping so many of us Elixir newbies that don’t always read the docs closely :blush: