Mukund

Mukund

  • NA
  • 9
  • 0

How to pass double couted paramaters to Command line utilities programatically in C#

Jun 8 2010 8:07 AM
Hello Experts,

Below is my command line which works fine and converts tab to shape file format.

C:\FWTools2.4.7\bin\ogr2ogr -f "MapInfo File" Morocco.tab Morocco.shp

How to execute the command line utility ogr2ogr by passing the arguments particularly the couted argument "MapInfo File" in c#. Below is my code, it does not show any error but its not doing the conversion.

Process proc = new Process();
string driver = "-f \"MapInfo File\" Morocco.tab Morocco.shp";
proc.StartInfo.FileName = @"C:\FWTools2.4.7\bin\ogr2ogr";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.Arguments = driver; 
proc.Start();

Help me to solve the problem.

Thanks
Mukund

Answers (1)