On Aug 7, 11:54*pm, Oliver <olli.m...@xxxxxx> wrote:
Quote:
> Hi Neil,
> Quote:
> > I'm not quite sure what you mean but each space denotes a new argument
> > (multiple spaces mean more arguments which get bundled into an array) so
> > using the approach you used to assign to $i is correct for specifying a
> > single argument
>
> That's right. But I want 'expand' $i in that way, that $i becomes the
> commandline
>
> ./test1 '1234 5678' 22 33 zzz
>
> and not
>
> ./test1 "'1234 5678' 22 33 zzz"
>
> Cheers,
> Oliver
>
>
> Quote:
> > "Test" <olli.m...@xxxxxx> wrote in message
> >news:%23xEdbDN%23IHA.4784@xxxxxx > Quote:
Quote:
> >> there are two scripts
> Quote:
Quote:
> >> test1.ps1:
> >> > $Args
> Quote:
Quote:
> >> test2.ps1:
> >> > $i = "'1234 5678' 22 33 zzz"
> >> > ./test1 $i
> Quote:
Quote:
> >> Running test2 -> Output
> >> > '1234 5678' 22 33 zzz
> Quote:
Quote:
> >> but it should be like
> >> test3.ps1:
> >> > ./test1 '1234 5678' 22 33 zzz
> Quote:
Quote:
> >> Running test3 -> Output:
> >> > 1234 5678
> >> > 22
> >> > 33
> >> > zzz
> Quote:
Quote:
> >> How can I use a normal string - without converting it to an array - as
> >> a variable. Or I'm totally blind?- Hide quoted text -
>
> - Show quoted text - Hi,
Try:
ps c:\> invoke-expression ".\test1.ps1 $i"
Hope this helps,
- Oisin
PowerShell MVP
http://www.nivot.org/