Re: External process fails with switch arguments
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Thu, 21 Jun 2007 12:34:05 -0700
On Thu, 21 Jun 2007 09:56:01 -0700, michael sorens <m_j_sorens@xxxxxxxxxxxxxxxx> wrote:
Sometimes you think too hard :-)
I think you're being too hard on him. He's just looking at your question at face value, assuming that everything you've done there is intentional..
I am simply using the DOS "date /t" command here which should return a value
like that shown in my test case. And it seems pretty clear that the problem
is in the .Net interface, not the "date" program itself.
Well, except for the fact that the "date" that takes "/t" as an argument isn't an executable program you can start using the fileName parameter of the ProcessStartInfo class. If you go to a command prompt in Windows and type "date", you get the built-in "date" command by default, but you can't use that "date" command as input to the creation of a process.
On my PC, I don't even have a "date" executable anywhere, and I can't start a process using that as the fileName parameter. If you do have a "date" executable that you are running (as it appears that you do), then you need to determine the correct arguments to use to get the output you desire. From your original post, it appears that "/t" is not the correct argument (though it is with the built-in "date" command).
For what it's worth, if you use this to create your ProcessStartInfo, you get what you're asking for:
ProcessStartInfo psi = new ProcessStartInfo("cmd", "/c date /t");
Though, it doesn't use your installed "date.exe" program, so if that was intentional, you'll have to figure out what arguments to pass to your installed "date.exe" program (as I suggest above).
Pete
.
- Follow-Ups:
- Re: External process fails with switch arguments
- From: Ben Voigt [C++ MVP]
- Re: External process fails with switch arguments
- References:
- RE: External process fails with switch arguments
- From: Steven Cheng[MSFT]
- RE: External process fails with switch arguments
- Prev by Date: Re: HTML Editor
- Next by Date: Re: a case for multiple inheritance
- Previous by thread: Re: External process fails with switch arguments
- Next by thread: Re: External process fails with switch arguments
- Index(es):
Relevant Pages
|
Loading