Solved netsh mbn show interfaces results in command not found on Win7 64Bit

mariovde

New member
Local time
6:42 AM
Messages
7
Hi,

I'm trying to run "netsh mbn show interfaces" from a .bat or .jar file on a Win7 64bit system but every time I run my file, it results in "The following command was not found mbn show interfaces".

When I run that same command in a cmd.exe prompt, the result is correct and as expected.
When we run /? we see "mbn" in available commands. When we output that same result from a .bat or .jar, we don't see that "mbn" command in the available commands for netsh.

Anybody know what's happening?
We know there are 2 netsh.exe files, one in sys32 and one in syswow64.

All help is appreciated.

Regards

Mario
 

My Computer My Computer

At a glance

Win XP
OS
Win XP
Does it work if you use C:\Windows\System32\netsh.exe when running from a .bat file?

Try doing a cmd /k echo %path% from a .bat file and see what the path environment variable is set to. Make sure C:\Windows\System32 is in the path and the path is not corrupted.
 

My Computer My Computer

At a glance

Windows 10 Pro X64Intel Quad Core i7-4770 @ 3.4Ghz16.0GB PC3-12800 DDR3 SDRAM 1600 MHzIntel Integrated HD Graphics
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
Everything points to the system32 folder...
calling the netsh with a full path makes no difference.
Some features are available, others are not.
 

My Computer My Computer

At a glance

Win XP
OS
Win XP
What did cmd /k echo %path% from a .bat file show?
 

My Computer My Computer

At a glance

Windows 10 Pro X64Intel Quad Core i7-4770 @ 3.4Ghz16.0GB PC3-12800 DDR3 SDRAM 1600 MHzIntel Integrated HD Graphics
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
the output on the device was:

C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\PROGRA~1\DISKEE~1\DISKEE~1\;
C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\;
C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64\;
C:\Program Files (x86)\Intel\Services\IPT\;
C:\Program Files\Intel\WiFi\bin\;
C:\Program Files\Common Files\Intel\WirelessCommon\;
C:\Program Files\Intel\MCA\Bin;
 

My Computer My Computer

At a glance

Win XP
OS
Win XP
The beginning of your path looks like mine.

What is C:\PROGRA~1\DISKEE~1\DISKEE~1\ ????

How are you calling the bat file? A link on the desktop or some other way?
 

My Computer My Computer

At a glance

Windows 10 Pro X64Intel Quad Core i7-4770 @ 3.4Ghz16.0GB PC3-12800 DDR3 SDRAM 1600 MHzIntel Integrated HD Graphics
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
we solved the problem:

When running the command "netsh mbn show interface" was running the cmd as a 64bit operation.
When running the command from an application - that is 32bit - the cmd is run as a 32bit operation. And the mbn-context is not available in 32bit.

In a windows 64bit os, a behind the scenes function exists: file system redirection.
Meaning: a 64bit process will call the equivalent 32bit process.

The workaround is that you use a csharp script or something else where you can override the file system redirection:

IntPtr ptr = IntPtr.Zero;
Wow64DisableWow64FsRedirection(ref ptr);
<your proces information here>
Wow64RevertWow64FsRedirection(ptr);
//always revert the operation.

and that solved it!
 

My Computer My Computer

At a glance

Win XP
OS
Win XP
Glad to hear you found a solution. Where did you find this info? It sounds a bit strange to me, so I'd like to read up on it a bit if I can.

Thanks
 

My Computer My Computer

At a glance

Windows 10 Pro X64Intel Quad Core i7-4770 @ 3.4Ghz16.0GB PC3-12800 DDR3 SDRAM 1600 MHzIntel Integrated HD Graphics
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
we solved the problem:

When running the command "netsh mbn show interface" was running the cmd as a 64bit operation.
When running the command from an application - that is 32bit - the cmd is run as a 32bit operation. And the mbn-context is not available in 32bit.

In a windows 64bit os, a behind the scenes function exists: file system redirection.
Meaning: a 64bit process will call the equivalent 32bit process.

The workaround is that you use a csharp script or something else where you can override the file system redirection:

IntPtr ptr = IntPtr.Zero;
Wow64DisableWow64FsRedirection(ref ptr);
<your proces information here>
Wow64RevertWow64FsRedirection(ptr);
//always revert the operation.

and that solved it!

And how do I compile the c# script, and run from a bat file?
 

My Computer My Computer

At a glance

Windows 7 Ultimate x86/x64 dual bootIntel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz2GB DDR2Intel 82945G Express Chipset Family v 8.15.10...
Computer Manufacturer/Model Number
assembled locally.
OS
Windows 7 Ultimate x86/x64 dual boot
CPU
Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz
Motherboard
ASUSTeK Computer INC. Model P5G-MX
Memory
2GB DDR2
Graphics Card(s)
Intel 82945G Express Chipset Family v 8.15.10.1930
Sound Card
Realtek High Definition Audio 2.65 v6..0.1.6449
Monitor(s) Displays
LG Flatron W1943S
Screen Resolution
1360*760
Hard Drives
Seagate SATA 250 GB, Seagate IDE 40 GB
PSU
beetel ATX
Case
Intex
Cooling
?
Keyboard
zebronics K06 non-multimedia
Mouse
zebronics M05
Internet Speed
3.1 Mbps reliance broadband+ (it crowls mostly)
Back
Top