run elixir script from mix with command line arguments like mix run my_app_script.exs arg1 arg2

I am trying to run an elixir script from mix with command line arguments arguments, i don’t want mix to compile the project, i just want to pass the script name and its arguments like

mix run my_app_script.exs arg1 arg2

More over when i run this command, it looks for the script in current directory, how do i change it to look for the script in ./lib folder

1 Like
  1. Mix will always compile the project it is in and then put it into the load path, as mix run explicitely “[s]tarts the current application and runs code” (from mix help run).

Also if you run a *.exs you need to specify the relative path yo your current working dir, so if you do not want to specify lib/ as a prefix you need to cd there first.