Pax
In Unix, I can do something like, `my-script.sh "command argument --option"`
Where `my-script.sh` is,
```sh
# other commands
# before I run the executable
./an_executable $1
```
And it will run as if I called `./an_executable command argument --option`
How do I the same in powershell?
Currently, doing something like, `my-script.ps1 "command argument --option"` will result to an error, `Error: No such command 'command argument --option'.`
Top Answer
Pax
Use `@Args` instead of `$Args`
This is known as [splatting](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.1):
> Splatting is a method of passing a collection of parameter values to a command as a unit. PowerShell associates each value in the collection with a command parameter. Splatted parameter values are stored in named splatting variables, which look like standard variables, but begin with an At symbol (@) instead of a dollar sign ($). The At symbol tells PowerShell that you are passing a collection of values, instead of a single value.
So, you can pass arguments to an executable inside a powershell script by calling your powershell script like so,
`my-script.ps1 command argument --option`
and inside the powershell script,
```
# other commands
# before I run the executable
./my_program.exe @Args
```
And the script will run calling,
`./my_program.exe command argument --option`