nbtstat: The system cannot find the file specified

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have a requirement to automate an NBTStat call and return the results. The program is in C# and I am running from a Windows 7 64-bit box.
I have tried including a valid path and extension on the filename. I can successfully NBTStat from a command prompt.
Any advice?
--------------------------------------------------------------------
The code is failing in the using line of the following method (and the exception follows):
<pre class="prettyprint private void NBTStatTheSelectedDevice(string selectedDevice)
{
ProcessStartInfo pi = new ProcessStartInfo()
{
FileName = "nbtstat",
Arguments = "-A " + selectedDevice,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process p = Process.Start(pi))
{
p.WaitForExit();
TestMessageText = p.StandardOutput.ReadToEnd();
}
}[/code]
Exception:
System.ComponentModel.Win32Exception was unhandled by user code<br/>
HResult=-2147467259<br/>
Message=The system cannot find the file specified<br/>
Source=System<br/>
ErrorCode=-2147467259<br/>
NativeErrorCode=2<br/>
StackTrace:<br/>
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)<br/>
at System.Diagnostics.Process.Start()<br/>
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)<br/>
--snipped--

View the full article
 
Back
Top