Long Enumeration of Files and Directories versus Unwanted Shorter Enumeration of Same

The command is:
 
cmd /C "dir /B <directory-name>"

where <directory-name> is C:\Windows\System32

When invoked programmatically from a C# method using the Start method of the System.Diagnostics.Process class,
the number of directories and files returned is 2,805.  When invoked from the ordinary Windows shell, the number
of directories and files returned is 3,552.  One example in the enumeration is the file C:\Windows\System32\slui.exe which appears in the lengthier enumeration but not in the shorter one.  System.IO.DirectoryInfo.GetDirectories() returns the
fewer files and directories as well.  Can you explain?  See all the files and directories that go missing in
the shorter enumeration. View the attachment. Which would be present had Microsoft provided the inte

February 25th, 2015 2:32pm

Hi,

First of all, when you run dir command with /B parameter, there is no summary.

In fact, your command should be without the /B parameter.

And then based on our test, the issue should be the platform structure. By default, the 32 bit will invoke C:\Windows\SysWOW64 instead of C:\Windows\System32.

Free Windows Admin Tool Kit Click here and download it now
February 27th, 2015 10:09am

I rebuilt the C# program after changing the Platform target to x64.  The program behaves the same.  I don't understand why you say the command should be without the /B parameter.  The idea is to produce a compact enumeration of things in the directory.  I've changed the C# program to run the command with and without the /B parameter.  It isn't clear to me that you understand what the issue is.  There should be no difference between the output produced by the command when invoked from inside a C# program and the output produced by the command when invoked at the C: prompt.  I've created complete documentation of the problem for you.  You can obtain a copy by downloading the file at http://www.mdrsesco.biz/UNEX.zip
February 27th, 2015 6:25pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics