PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,520 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Bonjour tous le monde,
Est t'il possible de faire un script PowerShell qui ouvre différent URL puis les ferme depuis un fichier Excel ?
Hello there,
Suppose you have a text file "url.txt" located in c:\temp and that each line in the file corresponds to a url you want to open with IE. Then the code below would open each url in the file.
$textfile = "c:\temp\url.txt"
ForEach ($url in Get-Content $textfile) {
$IE=new-object -com internetexplorer.application
$IE.navigate2($url)
$IE.visible=$true
}
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer--
If you're working with Excel spreadsheets you should install the ImportExcel module. It makes coding much simpler.
You haven't stated what information you need from the target URL so the code below just saves the web page(s) in an array.
Here's an example that does what you asked:
[array]$x = @()
Import-Excel C:\junk\urls.xlsx |
ForEach-Object{
$x += Invoke-WebRequest $_.URL -UseBasicParsing
}
Here's a sample spreadsheet: