如何重新使用通配符匹配? [英] How do I re-use my wildcard match?

查看:88
本文介绍了如何重新使用通配符匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要使用Windows命令提示符完成一些高级文件移动;可以使用通配符吗?

There's some advanced file moving that needs to be done with the Windows command prompt; Is it possible to do it with wildcards?

在UNIX中使用正则表达式,我可以执行类似的操作来查找以 s开头的所有文件,然后执行某些操作

Using regular expressions in UNIX, I could do something like this to find all files that begin with "s" and then do something else with them (echo).

ls s(.*) ; echo Found file \1 , needs to be moved to C:\unicorns\(\1)

我想在Windows命令提示符下执行类似的操作:

I want to do something like that in Windows command prompt:

:: find all files that begin with "s" and then do something else with them (echo)
dir s(*) ; echo Found file \1


推荐答案

执行以下操作:

for %%f in (*) do (echo %%f)

这将回显当前目录中找到的文件列表。
查找更多描述此处

This will echo a list of files found in current directory. Find more description here

这篇关于如何重新使用通配符匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆