How to do it

Let us assume that the guests are Mr Jain, Mr Jacobs, Ms Sanders, Mr Shah and Mr Hugo.

  1. Open a new file in Visual Studio Code and, in the script pane, type the following.
$GuestsRaw = Read-Host "Enter the guest names, separated by commas"
$Guests = $GuestsRaw -split ",$([regex]'[s]*')"

$Guests | ForEach-Object { Write-Output "Welcome, $PSItem!" }
  1. Run the script, and at the prompt, type in the names of the guests:
PS> Mr Jain, Mr Jacobs, Ms Sanders, Mr Shah, Mr Hugo
..................Content has been hidden....................

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