扩展通配符自变量Expanding Wildcard Arguments

Microsoft 专用Microsoft Specific

在运行 C 程序时,你可以使用两个通配符(问号 (?) 和星号 ())之一以便在命令行上指定文件名和路径参数。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. 你可以通过链接 setargv.obj 或 wsetargv.obj 文件将普通参数向量 argv 加载例程替换为不展开通配符的版本。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. 如果程序使用 main 函数,请与 setargv.obj 链接。如果程序使用 wmain 函数,请与 wsetargv.obj 链接。它们具有等效的行为。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.

若要与 setargv.obj 或 wsetargv.obj 链接,请使用 /link 选项。To link with setargv.obj or wsetargv.obj, use the /link option. 例如: For example:

cl example.c /link setargv.objcl 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.)

结束 Microsoft 专用END Microsoft Specific

另请参阅See Also

链接选项 Link Options
main 函数和程序执行main Function and Program Execution