Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I add range of ports in netsh add urlacl?

I use the following command to allow listening of specific HTTP ports:

netsh http add urlacl url=http://+:[port]/ user=DOMAIN\UserName

But if I need to open a range of ports, can I setup a single rule?

like image 995
Igor Semenov Avatar asked Jul 17 '14 12:07

Igor Semenov


1 Answers

I didn't find any way to specify a range so I went with using built-in FOR command:

for /L %i in ([port_start],1,[port_end]) do netsh http add urlacl url=http://+:%i/ user=DOMAIN\UserName

You can get more info on the FOR command by using 'FOR /?' in command prompt. /L happened to be the one that worked for me because it builds a set of numbers given start, stop and step values.

like image 109
censored Avatar answered Oct 10 '22 11:10

censored