I need to run another program with my program and pass a parameter to it.

I do it this way:

Process.Start("путь к программе", "параметр(в моем случае я хочу передать строку например E:\Downloads"); 

But instead, the program sends the string "path where the exe of my program is" + "E: \ Downloads"

  • Well, or how else can you do it using C #, the same thing that a bat file does with the following content: "the path to the program to be launched" - "E: \ Downloads \ 123.txt" - user210281
  • And why do you think that is transmitted incorrectly? What does your other program do? I think the problem is in it. - VladD
  • Well, the fact is that if you use the bat file, such problems do not arise. The second program should receive the parameter that I want to pass to it and output it to the textBox. - user210281
  • But nonetheless. A bat file is not an argument. Give the relevant part of the code of the second program. - VladD
  • Thank you for responding, but I already found an error - user210281

1 answer 1

Found a mistake! I'm not careful, I apologize. Wrong with the syntax. It was necessary so:

 Process.Start("путь к программе", "/E:\Downloads"); 

Just needed to add the right slash in the string with the parameter.

  • 3
    Surely you still need "/E:\\Downloads" (well, or @"/E:\Downloads" ). - VladD