1

I am using asp.net

this is my code:

        string cmd = "cmd";
        string enter = "/c";
        string exe =
            " ogr2ogr -f \"GeoJSON\" -t_srs WGS84 " +
            "C:\\Users\\subhi2\\Desktop\\WebSite9\\MapInfoFile\\aghat.json " +
            "C:\\Users\\subhi2\\Desktop\\WebSite9\\MapInfoFile\\aghat.TAB";

        try
        {
            Process p = new Process();
            p.StartInfo = new ProcessStartInfo(cmd, enter + exe);            
            p.Start();
        }
        catch (Exception)
        {

        }

I am tried to wrote in cmd. And its working.

ogr2ogr -f "GeoJSON" -t_srs WGS84 C:\Users\subhi2\Desktop\WebSite9\MapInfoFile\aghat.json C:\Users\subhi2\Desktop\WebSite9\MapInfoFile\aghat.TAB

How can I succeed ? (maybe folder or file access permission) Have a opinion ?

But not working in asp.(no error)

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
Osman Villi
  • 346
  • 2
  • 24

2 Answers2

0

How about this:-

 Dim _info As New ProcessStartInfo("cmd", "/C C: & CD C:\TEMP & DIR")
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
0

This worked for me

        System.Diagnostics.ProcessStartInfo my = new System.Diagnostics.ProcessStartInfo();
        my.FileName = Environment.ExpandEnvironmentVariables("%SystemRoot%") + @"\System32\cmd.exe";

        my.Arguments = "cmd /c D: && cd " + HttpContext.Current.Server.MapPath("~\\bin\\")+" dir";
        Process process = System.Diagnostics.Process.Start(my);