Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

powershell loop ip's in curl

$
0
0

Hi,

Having a little issue.

need to loop ip's listed in a text file into curl.

tried but failed here:

$d = "C:\Users\Administrator\Desktop\test.txt"
Get-Content $d |
    ForEach-Object
{
        Invoke-Command -ScriptBlock {curl.exe http://mysite.com/text/$($_.d)
}
}

it gives this:

cmdlet ForEach-Object at command pipeline position 2
Supply values for the following parameters:
Process[0]:

tried and failed here also:

$d = C:\Users\Administrator\Desktop\text.txt
$i = Get-Content -Path C:\Users\Administrator\Desktop\text.txt
ForEach-Object -process {curl http://mysite.com/text/$i}

Thanks for any assistance in advance.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>