0

I have an issue where I am attempting to pass information from a table in PowerShell into a URL but am not having any luck doing so.

$Content = Get-Content "C:\Utilities\Content.txt" -Raw
$ie = New-Object -ComObject InternetExplorer.Application
$line = Select-String "c:\utilities\Content.txt" -pattern ", ([A-Z])\w+ [[\d]{4}" -AllMatches | Select Line

$ie.Navigate("https://www.testurl.com/$line[1]")

I am attempting to pull information from the table with $line[1] or [2] for example and navigate to that address in the $ie.navigate command. When I call the command $line[1] I get back the information I require (although it comes with the the word "Line" above it ie:"

Line                                                                                                                                                                                                                                                                                                                                                      
----                                                                                                                                                                                                                                                                                                                                                      
Useful Information in this line here

although it does not appear to be accepting the variable inside the Navigate Method. Is it possible by having it in a table like this its not reading it correctly when i attempt to pass that information off the to Navigate Method? Any point in the right direction would be very helpful.

1 Answer 1

1

Correct your $ie.Navigate line to the following $ie.Navigate("https://www.testurl.com/$($line[1])")

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.