System.Diagnostics.Process to run DIR

D

David

Hi all,

I am attempting to run...

dir /s c:\ c:\mydir.txt

from within C#. (It works fine from a command prompt)

I am using

..StartInfo.FileName = "dir";
..StartInfo.Arguments = "/s c:\\ c:\\mydir.txt";

but when I attempt to run it, I am crashing out that the file is not found.

It appears that it is the dir command, which I think is not actually a file
but part of the core instructions built into the OS.

How do I run the dir command from within c#?

As a side note, I also attempted FileName = "cmd" and moved the dir to the
Arguments. This didn't fail, it just didn't work.

Thanks for your help.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top