Cannot start elixir application from powershell

When I type iex -S mix in PowerShell, I get this error:

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

What is the correct way to write '-S mix' after the 'iex' command to get the same effect as typing in cmd? This is a problem when I do not understand the PowerShell syntax, which I suppose.

+5
source share
2 answers

The problem is that iex is an alias in Powershell, short for Invoke-Expression . If you are trying to run the command iex.exe , iex.bat or iex.cmd , you will have to specify it in some unique way: an explicit (or full) path or even just adding an application extension may be enough. Therefore, Powershell will not launch Invoke-Expression .

Get-Command can fix this problem:

 PS C:\Dir> Get-Command iex CommandType Name ModuleName ----------- ---- ---------- Alias iex -> Invoke-Expression PS C:\Dir> Get-Command cmd CommandType Name ModuleName ----------- ---- ---------- Application cmd.exe 

It seems that it is impossible to specify both the type of the command and the path at the same time: if you want to see which iex is, you can use this form:

 PS C:\Dir> Get-Command -All iex -Syntax Invoke-Expression C:\windows\iex.bat 

You can learn more about how Powershell decides which team runs in the Microsoft Technology Library .

+8
source

For anyone who can see this question:

The short answer is to run iex from the Powershell class iex.bat . In this particular case, iex.bat -S mix

+5
source

Source: https://habr.com/ru/post/1258114/


All Articles