Interestingly, for me "date.exe /t" gives the expected output. Is that
still running a cmd.exe builtin? If so, I'd classify that as a bug.
(Tries with cygwin)
$ date.exe /t
date: invalid date `/t'
$ which date.exe
/usr/bin/date.exe
Seems like you might be running the cygwin (gnu-utils) version of date by
mistake. Check your path.
(Uses filemon to see what date.exe cmd calls)
No hits....
(Uses taskmgr to see what date.exe cmd calls)
None.
Looks like not only is "date" a cmd.exe builtin, so is "date.exe"??? Looks
like a bug...
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Thu, 21 Jun 2007 09:56:01 -0700, michael sorens
<m_********@newsgroup.nospamwrote:
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