Run wmic code Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
apoklyps3
Posts: 116
Joined: 13 Feb 2016, 13:20

Run wmic code

24 Apr 2018, 17:38

I'm trying to create a hotkey to set google dns on all found interfaces.
The easiest way seems to be via wmic with

Code: Select all

wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder ("8.8.8.8", "8.8.4.4")
I tried to set it up in ahk via the following code, but I'm getting "Return Value=70" wich translates to "Invalid Ip Adress".

Code: Select all

g::Run,%comspec% /k wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder ("8.8.8.8", "8.8.4.4")
Since the DNS adress is the only one specified I guess thats the "invalid adress" and I suspect that the quotes or some other symbol in the expression has to be escaped somehow, but for the life of me I can't figure out how... I've multiple sultions like double the quotes, double the quotes and ', for the comma...still no go
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: Run wmic code  Topic is solved

24 Apr 2018, 18:38

The comma needs to be escaped.

Code: Select all

g::Run,%comspec% /k wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder ("8.8.8.8"`, "8.8.4.4")
apoklyps3
Posts: 116
Joined: 13 Feb 2016, 13:20

Re: Run wmic code

24 Apr 2018, 23:53

Can't believe how stupid I was.
Confusing ' with `
Thanks. It was driving me mad

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput and 286 guests