Way of Script Execution

This topic contains 6 replies, has 5 voices, and was last updated by  Kevyn 3 months, 4 weeks ago.

  • Author
    Posts
  • #77545

    Raghavendran
    Participant

    Hi,

    I Powershell, if we have 10 lines of code – is each line of code is executed sequentially?

    If there is copy statement in 4th line and in case if the copy takes around 5 mins to complete, when will be 5th line execute? Does it wait for the copy to complete and then the control move to next line?

    Please clarify and many thanks in advance!

  • #77550

    Olaf Soyk
    Participant

    Hi,

    you should urgently start to learn the basics of Powershell and maybe a little basic computer technology in general. I think it will pay off for you in the future.

    is each line of code is executed sequentially

    Yes.

    If there is copy statement in 4th line and in case if the copy takes around 5 mins to complete, when will be 5th line execute? Does it wait for the copy to complete and then the control move to next line?

    If you're not sure about something – you should try it by yourself. Then you know it for yourself.

  • #77557

    Raghavendran
    Participant

    Thanks very much Olaf. Yes, I am new to Powershell and I have been using PowerShell since last 2 days. Can you please let me know where I can start with learning the basics of PowerShell? I used to go through some YouTube videos, but if you can suggest it would be of great help.

    Thanks in advance!

  • #77559

    Simon B
    Participant
  • #77560

    Olaf Soyk
    Participant

    Here you have some good resources to start with: Beginner Sites and Tutorials

  • #77563

    Richard Siddaway
    Moderator

    Unless you're using PowerShell workflows or runspaces (as a new user don't even think about it at this stage) all commands run sequentially. One command has to finish before the next can start. if you're using a pipeline then the pipeline is effecively treated as a single command – {to more experienced users I KNOW that's a simplification but its accurate enough for this discussion)

    In terms of learning PowerShell you should take a structured approach – the Microsoft MVA, or an introductory level book such as PowerShell step by Step or the Month of Lunches book

  • #77641

    Kevyn
    Participant

    I would highly recommend the Learn Windows PowerShell In A Month of Lunches book in concert with the Microsoft MVA Getting Started With Microsoft PowerShell course. They compliment each other.

    Then, if you want to go further, I highly recommend Learn PowerShell Toolmaking In A Month Of Lunches in concert with the Microsoft MVA Advanced Tools & Scripting with PowerShell 3.0 Jump Start course. Again, they compliment each other.

You must be logged in to reply to this topic.