user997112
user997112

Reputation: 30645

Calling dumpbin from C# not recognized?

I am trying to use dumpbin (which I saw from another SO post is installed with Visual Studio) to disassemble a .exe from C#. However, I get an error saying

dumpbin is not recognized as an internal or external command

  1. Why is it not recognized if dumpbin comes with Visual Studio?
  2. Once this is recognised, how could I output to a string, rather than a file?

I am using Visual Studio 2013.

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace Objdump
{
    class Program
    {
        static void Main(string[] args)
        {
            ProcessStartInfo ProcessInfo;
            Process Process;

            ProcessInfo = new ProcessStartInfo("cmd.exe", "/K " + "dumpbin /DISASM /out:log.txt MyExe.exe");
            ProcessInfo.CreateNoWindow = true;
            ProcessInfo.UseShellExecute = true;

            Process = Process.Start(ProcessInfo);
        }
    }
}

Upvotes: 1

Views: 759

Answers (1)

Lloyd
Lloyd

Reputation: 29668

The path to dumpbin.exe needs to be on the PATH environment variable otherwise you'll need to supply the full path yourself.

For me it happens to be C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin.

Upvotes: 2

Related Questions