Question

So, I've got this command running properly on my PC. I've added it to a directory in the PATH environment variable so that it can be run from anywhere. See normal results:

C:\>curl
curl: try 'curl --help' or 'curl --manual' for more information

But, when I try to have that command executed in C#:

Process.Start("cmd.exe","/K curl");

I end up with:

'curl' is not recognized as an internal or external command,
operable program or batch file.

C:\<project path>\bin\Debug>

Is this another noobish mistake? I'm new to C#, making the switch from Java, so thanks in advance for your help.

Was it helpful?

Solution 2

I had curl.exe in C:/Windows/System32. I got around the problem by creating a C:/curl directory, adding it to Path and putting the executable inside it. Still doesn't work when running it directly, but I can call the command line to do it.

Process.Start("cmd.exe","/K curl");

OTHER TIPS

It's not necessary to launch your executable using cmd.exe.

Try launching it directly like the following :

Process.Start("curl");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top