开发者

Window shell - list of file as a command input

In Unix, I can provide a command with a list of files by doing that:

开发者_Python百科
mycommand folder/*

The argc will then be equal to the number of files in the directory and argv to the name of each files in the directory.

However, this doesn't seem to be the same on Windows. Is there a way to emulate this without listing all the files of the folder as argument to the command?

Thanks.


Windows command prompt does not natively support wildcard expansion. If "myprogram" is an application build with Visual C++ and you have control over how it is built, you can add support for wildcards to the application itself, as described in MSDN article Expanding Wildcard Arguments


From here:

To delete every .bak file in every subfolder starting at C:\temp

C:\>FOR /R C:\temp\ %%G IN (*.bak) DO del %%G

Also take a look on FORFILES.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜