Partager via


Expanding Wildcard Arguments

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Expanding Wildcard Arguments.

Microsoft Specific**

When you run a C program, you can use either of the two wildcards — the question mark (?) and the asterisk (*) — to specify filename and path arguments on the command line.

By default, wildcards are not expanded in command-line arguments. You can replace the normal argument vector argv loading routine with a version that does expand wildcards by linking with the setargv.obj or wsetargv.obj file. If your program uses a main function, link with setargv.obj. If your program uses a wmain function, link with wsetargv.obj. Both of these have equivalent behavior.

To link with setargv.obj or wsetargv.obj, use the /link option. For example:

cl example.c /link setargv.obj

The wildcards are expanded in the same manner as operating system commands. (See your operating system user's guide if you are unfamiliar with wildcards.)

END Microsoft Specific

See Also

Link Options
main Function and Program Execution