0

I run my Windows 7 laptop in Spanish as it helps me learn that language. Recently I wanted to set up a DOS batch file to disable a number of network adapters - however in Spanish, the network adapter names use special (non-ANSI) characters. For example the accented characters in this name:

Conexión de área local 4

I copy/pasted the names from the Network Connections window into my .bat file, but on execution got the error "No existe una interfaz con este nombre registrada con el enrutador", i.e. it couldn't find an adapter with that exact name.

Using Notepad++, I changed the encoding of my .bat file from ANSI to UTF-8 (both with and without BOM), but continued to get the same error. (I pasted in the adapter name each time after changing encoding).

So the question is, what is the best way to get the exact adapter name into my batch file, so that it will be recognised by Windows when I execute it?

6
  • You're not telling us which character set your Spanish Windows actually uses. It looks like it's not ANSI (and that would in fact be very unusual). So presumably, it's using an ISO Latin character set whichshould be able to represent Spanish characters. Opposed to that, if you use a different encoding in your editor for a BAT file, you'd have to tell the command interpreter that the BAT file is not encoded in the system's default character set.
    – Run CMD
    Jan 28, 2016 at 8:04
  • The cmd.exe interpreter doesn't support UTF-8, but it should work with UTF-16... Jan 28, 2016 at 8:07
  • @ClassStacker - when I run chcp in a command window, I get the active code page is 850. Is that what you were asking?
    – Mike
    Jan 28, 2016 at 8:28
  • @ClassStacker - that led me to change my .BAT file to use Character Set OEM 850 in Notepad++, and now it works perfectly. Can you add this as an answer so I can accept it? (Strangely the Bluetooth adapter is still an exception tho').
    – Mike
    Jan 28, 2016 at 8:30
  • You could try UTF-16 in line with @grawity's suggestion that cmd.exe should be able to auto detect that. -- What about the blutooth isn't working? What's even in your BAT file?
    – Run CMD
    Jan 28, 2016 at 8:40

1 Answer 1

0

After trying various methods, I eventually found the following worked:

  • Change my .BAT file back to ANSI
  • Run the following DOS command to generate a text file listing the adapters

    netsh interface ip show interfaces > list.txt

  • Copy/paste the adapter name from the .TXT file to my .BAT file.

I should note that the adapter name does look odd with this method, but it works:

Conexi¢n de  rea local 4

However - for some reason it doesn't work with all of my adapters. For example, this one does not get recognised when I execute the .BAT:

Conexi¢n de red Bluetooth

1
  • Apply CHCP 1252 prior to running > list.txt netsh interface ip show interfaces and keep your bat script in ANSI encoding. Not much more to say not knowing related problematic code snippet.
    – JosefZ
    Jul 2, 2016 at 10:11

You must log in to answer this question.

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