DonationCoder.com Software > Find And Run Robot
netsh alias problem
ali79:
Hi, I am trying to get a netsh alias working.
Trying to achieve:
Alias:
dns 8.8.8.8
to launch
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
and if Alias:
dns dynamic
then
netsh interface ip set dns "Local Area Connection" dhcp
As a simple case I have tried putting dns as alias name, leaving all optional and
Change DNS - $$1 | netsh interface ip set dns "Local Area Connection" static $$1
but this doesn't seem to be working. As soon as I type the first number, the alias disappears from result and pressing enter does nothing, like when I try dns 8.8.8.8 with the above alias.
Any ideas?
Also can I prepend runcap with the above alias to get it to display the output?
Thanks!
mouser:
Hi ali,
You are on the right track -- but you want to use a regular expression to capture the 8.8.8.8 stuff
So make your alias called netsh,
But make the regex pattern to match:
^netsh (.*)$
and then you will also need to modify your command to run to specify the full path to the netsh.exe
and yes i think runcap should work fine with this.
See if that's enough to get it solved and maybe post your solution for others if so. if not let me know where you get stuck.
ali79:
Thanks for your answer, never realized the regular expression was there to match the input. So, here's what I have got:
Alias Name : dns
Reg Exp: ^dns (.*)$
Code: Change DNS - $$1 | runcap netsh interface ip set dns "Local Area Connection" $$1
This allows me to switch between
dns static 8.8.8.8
and
dns dhcp
I can see that farr now tries to execute this but nothing happens. Anyway to see any logs or to find what the problem is? As the same command runs fine within farr without the alias. I have tried the alias with and without the runcap.
Thanks!
mouser:
dont just put netsh, you have to specify a full commandline path to it.
ali79:
dont just put netsh, you have to specify a full commandline path to it.
-mouser (September 25, 2011, 04:14 PM)
--- End quote ---
netsh was on my path so I thought I would be ok. Giving full path got it working! Thanks!
However, I can't get it to run in runcap. I have tried "runcap dns static 8.8.8.8" but I think runcap thinks dns is a commandline app. Also tried prepending runcap within the alias itself.
Navigation
[0] Message Index
[#] Next page
Go to full version