How do I re-use my wildcard match?

我们两清 提交于 2019-12-12 02:57:56

问题


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

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)

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

回答1:


Do something like this:

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

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



来源:https://stackoverflow.com/questions/31144045/how-do-i-re-use-my-wildcard-match

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!