0

I am getting some odd results when trying to run a process from a string:

                    Process p = new Process();
                    p.StartInfo.WorkingDirectory = "dump";
                    p.StartInfo.FileName = s;
                    p.Start();

s = run.exe "mp4:production/CATCHUP/"

I am getting odd results such as:

"test.exe \"mp4:production/CATCHUP/\""

Obviously when this command executes, it throws an exception, how can I get rid of all of the backspaces?

2
  • if you mean \" this is just rapresentation of ", so it reflects what string is actually. It's correct and should not harm process running. Commented Jul 16, 2011 at 18:46
  • 1
    Clearly the problem is that "run.exe" somehow got transformed into "test.exe". Very strange. Don't pay attention to the \" in the debugger output, that isn't really there. Just its way to show an embedded double-quote, just like you'd write it in C#. Use the text visualizer, click the magnifying glass. Letting us guess at the exception is pointless. Commented Jul 16, 2011 at 18:53

1 Answer 1

1

May be I understand your problem. At least looking on your code, it seems to me that you pass like a p.StartInfo.FileName=s, where s="test.exe **\"mp4:production/CATCHUP/\"**" where part in bold is an argument for executable, which is wrong

Try to do something like this:

  Process p = new Process();
  p.StartInfo.WorkingDirectory = "dump";
  p.StartInfo.FileName = "test.exe"; // only executable name run or test???
  p.StartInfo.Arguments = "mp4:production/CATCHUP/"; //only arguments
  p.Start();

Regards.

EDIT

Good notice that in code presented run.exe became accidentially test.exe +1 for @Hans

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.