Many thanks for your answer.
I made a test but it looks like commands in a .ps1 file are executed asynchronously.
So, for example, the third command is executed without waiting for the second to complete.
If I create a .cmd file the commands are executed in synchronous way, that's the reason because I considered creating and running a .cmd file.
How can I solve my issue?