On Sep 1, 1:56 am, "Keith Hill [MVP]"
<r_keith_h...@xxxxxx_no_spam_I> wrote:
> "Shay Levi" <n...@xxxxxx> wrote in message
>
> news:8766a94462c68c9ba5b9e1990f2@xxxxxx
>
> > Not working in my case >
> > PS C:\WINDOWS> powershell -command "C:\test test\test.ps1"
> > The term 'C:\test' is not recognized as a cmdlet, function, operable
> > program, or script file. Verify the term and try again.
> > At line:1 char:8
> > + C:\test <<<< test\test.ps1 >
> Yeah that little ol' space really throws a monkey wrench in the works. This
> works also:
>
> powershell -noprofile -command "& 'c:\temp\foo bar\baz.ps1'"
>
> That is pretty close to what you would have to type at the PoSh prompt -
> just some confusion on the quoting.
>
> --
> Keith Hmm ...
----------script----------
# baz.ps1 #
write "hello baz, THAT WORKED"
----------------------------
C:\>powershell -command "c:\temp\'foo bar'\baz.ps1"
hello baz, THAT WORKED
C:\>powershell "c:\temp\'foo bar'\baz.ps1"
hello baz, THAT WORKED
C:\>powershell 'c:\temp\"foo bar"\baz.ps1'
c:\temp"foo bar\baz.ps1
C:\>powershell 'c:\temp\foo bar\baz.ps1'
c:\temp\foo bar\baz.ps1
-Hecks