2

On a windows7 machine I was trying to set the standard gateway following this example:

netsh.exe interface ipv4 set route 0.0.0.0/32 "Internet" 172.16.5.1

which returned the following error:

The filename, directory name, or volume label syntax is incorrect

Why is that the case, and how can I fix set the standard gateway for my connections?

3
  • What are you trying to accomplish by 0.0.0.0/32? This won’t ever match anything, except 0.0.0.0. 0.0.0.0/8 is a reserved net.
    – Daniel B
    Jul 22, 2014 at 12:31
  • @Daniel: So the example in the link given does not make any sense?
    – Alex
    Jul 23, 2014 at 5:29
  • 1
    Exactly, it’s simply wrong. You can easily check this yourself: run netsh interface ipv4 show route and you’ll see the default gateway has 0.0.0.0/0 as its target network.
    – Daniel B
    Jul 23, 2014 at 5:54

4 Answers 4

4

You need to use your real interface's name instead of "Internet". You can list them with netsh interface show interface.

3

There's some kind of an "underlying name" to the interface, set up on its 1st creation, or when it's manually changed. You can get it using:

netsh interface ipv4 show config

It might be different from what you see in the GUI window or from running netsh interface show interface

Try using that interface name instead - this worked for me on windows 7.

1

I just had a similar same issue. The problem was the " character. I copied the netsh from a word document I got from our software vendor and pasted that directly into the CMD and changed the needed parts which failed with the error mentioned here. However when I copied the string at first to notepad and replaced one from the " I discovered that they are different, so I replaced both / re-typed both and the issue is solved now.

0

Apparently on Windows 7, you need to use a different syntax to execute the command in the correct context. Preface the context specifiers interface ipv4 with a -c parameter and quote the entire context specifier. For example, to set the adapter to DHCP:

netsh -c "interface ipv4" set address name="Local Area Connection" source=dhcp

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .