Batch Check for Same Name in folder And Replace it with that
IF inside my .txt file called named.txt has the following text in them. 2005060.png “3/1/2005” The 2005060 is a parse text that came from A2005060SAMPLE.png. Is there a way to create a batch file to check the folder the same folder where the .png are located and revert back to their original name while leaving dates such as “3/1/2005” next to it intact. For example: name.txt file has
2005060.png “3/1/2005
2005070.png “3/11/2005 2005080.png “3/21/2005 2005090.png “3/31/2005The batch file will check for a piece of 2005060 in the same folder and find that there is one but named A2005060SAMPLE.png as a name and replace it will that one and output to name2.txt
A2005060SAMPLE.png “3/1/2005
A2005070SAMPLE.png “3/11/2005 A2005080SAMPLE.png “3/21/2005 A2005090SAMPLE.png “3/31/2005Thanks for anyhelp in this!!! :)开发者_如何学Python
How about:
@echo off
for /f "tokens=1,2* delims=. " %%i in (named.txt) do (
for %%m in (*%%i*) do echo %%~nxm %%k >> outfile.txt
)
精彩评论