0

In a powershell script I need to start the process powershell and tell it to run the script foo.ps1 like so:

start-process powershell C:\foodir\foo.ps1

But I ran into problems when I needed the script foo to be run with parameters. I tried some code like this:

start-process powershell (C:\foodir\foo.ps1 -paramforfoo test)

but this simply freezes the script when it gets to this line and throws no errors. I think it is trying to pass the parameter test to the powershell process and not to the script foo. How can I run this script with parameters?

bob0007
  • 111
  • 2
  • 4

1 Answers1

0

Try using quotes to collect your command. E.g.

Start-Process powershell ".\Untitled3.ps1 -testparam 'hello world'"
Frode F.
  • 52,376
  • 9
  • 98
  • 114