when i use Process.Start() and dos command < or >

  • Thread starter Thread starter somequestion
  • Start date Start date
S

somequestion

there are some dos command < or >
it can use like this
if there is a batch file as sample.bat
sample.bat < parameter
sample.bat parameter > result .

i just wanna use this when i use Process.Start() method.
but < is not recongnise a parameter .
how can i do?
 
did you test this?
it won't be work...... > or < is not recongnise a parameter
that's why it won't be work
 
somequestion said:
there are some dos command < or >
it can use like this
if there is a batch file as sample.bat
sample.bat < parameter
sample.bat parameter > result .

The topic is called "redirecting stdin/stdout of a child process".
..Net provides some support for it, e.g. here:
http://msdn.microsoft.com/library/d...StartInfoClassRedirectStandardOutputTopic.asp
What you can do is take what you get from p.StandardOutput and put it
into your output file.

win32 also allows you to redirect stdin/stdout so they go directly to
files that you specify, rather than you having to access them via the
streams p.StandardOutput and p.StandardInput. I don't think this
functionality is exposed in .net. So if you wanted to do this, you
should look up CreateProcess/STARTUPINFO/STARTF_USESTDHANDLES.
 
Hi,

That's why I suggested to put it into a batch file, then execute the batch
file. In other words, a batch file that executes a batch file.

If "parameter" is something that needs to be supplied from managed code, it
can be passed in as an argument to the new batch file:

"Process.Start Method (String, String)"
http://msdn2.microsoft.com/en-us/library/h6ak8zt5.aspx
 
The < and > characters are reserved by the command interpreter. They are
pipe redirection symbols. In order to pass them as arguments, put the caret
(^) immediately before them.

To pass > ^>
To pass < ^<

Other characters like this are & | ( ) and ^.

Mike Ober.
 
Back
Top