Powershell script to run another powershell script and wait till over

Question:

i’m trying to run a script which will run another powershell script.
i need the first script to continue only after the other one is over.
something like:

start Copy.ps1
wait till Copy.ps1 is done
continue with the script

tried using the Invoke-Expression but it doesn’t have wait parameter.

Answer:

I think you easily can do it by calling the file like this:

it will call the whole script in Copy.ps1 and continues after copy.ps1 finished.

Other method is you set the whole script in copy.ps1 into a function.

in CopyScript.ps1:

And in your new File:

Greetz Eldo.Ob

Source:

Powershell script to run another powershell script and wait till over by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply