0

I have a text file containing websites

whatsmyip
stackoverflow

and I want to join each line with .com at the end of each site. What is the best way to accomplish this? I set a variable called $sites and on that variable I called the .txt file into the script with get-content I tried doing a foreach loop to join the two text but my syntax isn't working. Any suggestions?.

foreach ( $website in $site  ) {
 $website -join ".com"
}

1 Answer 1

3

You can use "$website.com" to create the string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.