How to found a file and get its path

April 6, 2010 at 20:57:23
Specs: Windows 7
I have a software which keeps its user configuration in a random folder name. It looks like "%AppData%\TheSoftware\Random_Number_Here\UserConfig.ini".

I want to replace UserConfig.ini with my backed up one by a batch file, but how do I get the full path with this random folder name?


See More: How to found a file and get its path

Report •


#1
April 7, 2010 at 01:36:44
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/s/a-d "%AppData%\TheSoftware\UserConfig.ini"') do (
copy backup.ini "%%a"
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
April 7, 2010 at 03:40:09
Thanks! It is exactly what I'm looking for. I added this to my unattended installation.

I'm sure it can be done by batch but didn't expect it to be so elegantly!


Report •
Related Solutions


Ask Question