M
Mike Kamzyuk
Hello all. This topic has been covered on google groups before, but I
couldn't find a good response.
I have a shell command I wish to execute from c# (or vb or your
favorite .net language). I know the relevant class is
System.Diagnostics.Process.
The problem is that I don't know the name of the exe (or bat, or
whatever) of the process. This seems to be a requirement for the
Process class. All I have is a string (which is the command I want to
execute).
So let's say the string is
myCommand c:\*.* > c:\temp\crap.txt
and assume I don't know where myCommand is (perhaps its path is in the
PATH system var). That is, even if I could parse the command, it
wouldn't help. I'm not quite willing to look up environment variables
just now. (In my case, myCommand is dir, but that's not the point).
How do I go about executing this?
My current solution of writing a perl script and passing the command as
a param seems ridiculous, although perl handles it well.
Thanks ahead of time,
Michael Kamzyuk
couldn't find a good response.
I have a shell command I wish to execute from c# (or vb or your
favorite .net language). I know the relevant class is
System.Diagnostics.Process.
The problem is that I don't know the name of the exe (or bat, or
whatever) of the process. This seems to be a requirement for the
Process class. All I have is a string (which is the command I want to
execute).
So let's say the string is
myCommand c:\*.* > c:\temp\crap.txt
and assume I don't know where myCommand is (perhaps its path is in the
PATH system var). That is, even if I could parse the command, it
wouldn't help. I'm not quite willing to look up environment variables
just now. (In my case, myCommand is dir, but that's not the point).
How do I go about executing this?
My current solution of writing a perl script and passing the command as
a param seems ridiculous, although perl handles it well.
Thanks ahead of time,
Michael Kamzyuk