Re: External process fails with switch arguments

Tech-Archive recommends: Speed Up your PC by fixing your registry



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" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote in message
news:op.tuady3ab8jd0ej@xxxxxxxxxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • Re: External process fails with switch arguments
    ... 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. ...
    (microsoft.public.dotnet.languages.csharp)
  • Problems creating a process from a .net service
    ... I want to print pdf files by calling the Adobe Acrobat 4 command line ... ProcessStartInfo psi = new ProcessStartInfo; ... If i do this in a normal command line tool, ... Windows XP SP2. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How do I launch a process with parameters
    ... You've got your command line parameters included in the program name in the ... Do the ProcessStartInfo thing with the Filename and Arguments ... >>> launching IE with a URL but the above command did not work. ...
    (microsoft.public.dotnet.framework)