WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

In WinBatch we let the OS do the wildcard matching

Keywords:   wildcard masks

Question:

It looks like in WinBatch we let the OS do the wildcard matching for us, so WinBatch functions like FileItemize("*.txt") work just like the DOS DIR command does, so you can get different results depending on what OS (or maybe in the case of W2K - Service pack level).

Answer:

OK, I put together some fresh installations of various versions of Windows under VMware and here's what I was able to determine through some testing...

I created 3 files named "a.txt", "aa.txt" and "aaa.txt" in a temporary directory on each system. Then, from within a console window [COMMAND.COM on the Win9x platform family, CMD.EXE on the NT platform family], I issued the command "DIR ???.TXT". On all of the Win9x platform family systems, the output contained just "aaa.txt". On all of the NT platform family systems, the output contained all three file names.

I tested with Win95 OSR2, Win98 Second Edition and Windows ME for the Win9x platform family. For the NT platform family, I tested with WinNT Workstation v3.51, WinNT Workstation v4.0 SP6a, WinNT Terminal Server Edition v4.0 SP6, Win2K Pro SP2, Win2K Pro SP3, Win2K Advanced Server [no SP] in Terminal Server mode and with Win2K Server SP2. Within their respective platform families, the behavior was consistent w.r.t. how the wildcard character "?" is handled.

I also tested with COMMAND.COM on the NT platform family to see if there was anything to be noted about differences in COMMAND.COM and CMD.EXE since they are the programs that actually implement the DIR command. However, on the NT platform family COMMAND.COM appears to work just like CMD.EXE.

The next tests to perform would be to write a simple little console program that uses FindFirstFile() & FindNextFile() to test the low-level Win32 API functions to verify that this behavior is being caused by a difference in how the Win32 API is implemented on the two different platform families.


Article ID:   W15547
File Created: 2003:05:13:11:28:40
Last Updated: 2003:05:13:11:28:40