Question : How do I create wildcards for folder names?

How do I copy a file into a profile folder that has a random name?  It's a firefox profile folder, I want to replace the prefs.js file to set the home page using a batch login script.  

Answer : How do I create wildcards for folder names?

Paste the script below into a text file with a .cmd extension.  Customize the value of the parent variable with the location of Firefox's Profiles directory (as written it's set to the default).  Customize the value of the newfile variable with the location of the new prefs.js file to copy.

Running the script will echo the command to be run.  Once you have tested it successfully, remove the echo from line 7 to execute the command.

1:
2:
3:
4:
5:
6:
7:
8:
@echo off
setlocal
 
set parent=%appdata%\Mozilla\Firefox\Profiles
set newfile=c:\files\prefs.js
 
for /F "tokens=*" %%G in ('dir "%parent%" /A:D /B') do echo xcopy "%newfile%" "%parent%\%%G\" /C /H /R Y
pause
Open in New Window Select All
Random Solutions  
 
programming4us programming4us