IEx is Elixir’s interactive shell, where you can type any Elixir expressions and get its result.

One issue you might come across when trying to use `iex` in Powershell, through a command e.g. `iex -S mix`, you might get the following error:

Invoke-Expression : A parameter cannot be found that matches parameter name 'S'.
At line:1 char:5
+ iex -S mix
+     ~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Expression], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeExpressionCommand

The problem is that `iex` is an alias in Powershell, for `Invoke-Expression`

PS C:\Workspace> Get-Command iex

CommandType     Name                       Version    Source
-----------     ----                       -------    ------
Alias           iex -> Invoke-Expression

Solution

To overcome this problem you simply use `iex.bat` instead of `iex` in Powershell. So, if you type `iex.bat -S mix`, you ‘ll get the following output:

PS C:\Workspace\Research\elixir\physics> iex.bat -S mix
Eshell V8.0  (abort with ^G)
Compiling 1 file (.ex)
Generated physics app
Interactive Elixir (1.4.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

and you are ready to start working with elixir’s interactive shell.

 

Categorized in:

Tagged in: