batch file command to continue execution after calling a powershell script which is located outside

Need one command, let me explain my query.
I am running a robocopy command using the .bat file

robocopy c:\Testing d:\Testing

After above command, I am calling powershell script by using below command.

powershell.exe -noexit -file .\Testreplace.ps1

Now, I wanted to continue the execution of remaining script in .bat file once the above powershell script is executed.

robocopy c:\test2 d:\test2

But it is not getting back to .bat script. Please give me any suggestion/command to continue execution.

–> My complete script:
robocopy c:\Testing d:\Testing
powershell.exe -noexit -file .\Testreplace.ps1
robocopy c:\test2 d:\test2

Issue is, execution stopped at 2nd line only, not coming to 3rd line.
Please advise. Thanks in advance.

Answer

Just remove the (rather obvious) -noexit parameter to Powershell and it will actually exit after finishing to run Testreplace.ps1.

Attribution
Source : Link , Question Author : kasula praveen , Answer Author : Sven

Leave a Comment