How to do it...

  1. At the script pane, type in:
Write-Host "Hello, World!"
  1. Save (File > Save or Ctrl + S) the script.
  2. Click on Debug in the left. Alternatively, press Ctrl + Shift + D. This opens the Debug pane.
  3. Press the green play-button-like Start debugging button.

The console should pop out and display Hello, World!.

  1. Let us run the script one more time. This time, we will not open the Debug pane or press buttons on the screen. Simply, press F5.

Hello, World! should again be displayed in the console.

Let us now call the script without using the debug controls.

  1. Close the file (Ctrl + W).
  2. At the prompt on the console, type in:
./hello-world.ps1

You should see Hello, World! appear.

  1. Now, navigate to home.
  2. Next, type &, add a space, ./ and start typing the path to where you stored the script. Use tab completion just like how you would on Bash.
  3. When you reach the location of the script file, press Enter to call the file.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.252.201