Wildcards
Moderator: DosItHelp
-
- Posts: 4
- Joined: 11 Sep 2012 14:01
Wildcards
hey all, I am new to the forum and fairly new to batch as well. I came across this post that ALMOST answered my questions:
viewtopic.php?f=3&t=2619&p=11995#p11995
the only problem as that I had two folders that need a wildcard. The above showed for a path with 1 wildcard.
I have tried working off of the working code in the link but am lost when trying to set another array for the second wildcard.
The path I am having issues with is: C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles\zu97pxta.default
I am trying to save off the pref.js from the mozilla firefox 15.0.1 install to another location and then copy over the preconfigured prefs.js that I need.
I am trying to do this for all of the users that have a profile on the system since mozilla is profile specific, hence those two folders that need a wildcard.
Any help would be greatly appreciated!
thanks!
viewtopic.php?f=3&t=2619&p=11995#p11995
the only problem as that I had two folders that need a wildcard. The above showed for a path with 1 wildcard.
I have tried working off of the working code in the link but am lost when trying to set another array for the second wildcard.
The path I am having issues with is: C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles\zu97pxta.default
I am trying to save off the pref.js from the mozilla firefox 15.0.1 install to another location and then copy over the preconfigured prefs.js that I need.
I am trying to do this for all of the users that have a profile on the system since mozilla is profile specific, hence those two folders that need a wildcard.
Any help would be greatly appreciated!
thanks!
Last edited by engima8559 on 12 Sep 2012 08:54, edited 1 time in total.
Re: Wildcards
engima8559 wrote:I am trying to save off the pref.js from the mozilla firefox 15.0.1 install to another location and then copy over the preconfigured prefs.js that I need.
Is that all you need to do?
-
- Posts: 4
- Joined: 11 Sep 2012 14:01
Re: Wildcards
foxidrive wrote:engima8559 wrote:I am trying to save off the pref.js from the mozilla firefox 15.0.1 install to another location and then copy over the preconfigured prefs.js that I need.
Is that all you need to do?
Thanks for the response. Yes, I have the install, error checking, exit routines all working. I just need to incorporate this move and subsequent replace for the prefs.js. All will done on the box locally, no shares involved.
Thanks!
Re: Wildcards
This should do it (untested)
Code: Select all
@echo off
set "folder=C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles"
set "target=c:\backup"
set "prefs="c:\folder\prefs.js"
for /f "delims=" %%a in ('dir "%folder%" /a-d /b') do (
if exist "%folder%\%%a\prefs.js" copy /y "%folder%\%%a\prefs.js" "%target%\%%a-prefs.js" >nul
copy /y "%prefs%" "%folder%\%%a" >nul
)
-
- Posts: 4
- Joined: 11 Sep 2012 14:01
Re: Wildcards
Thanks but the pathing is not found. The prefs.js in the firefox install is located in each user's profile area:
C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles\zu97pxta.default\prefs.js"
The areas bolded are going to be different for every user and I do not know the usernames of the users. Those two bolded folders need to be wildcarded.
thanks
C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles\zu97pxta.default\prefs.js"
The areas bolded are going to be different for every user and I do not know the usernames of the users. Those two bolded folders need to be wildcarded.
thanks
Re: Wildcards
Ahh, yes. I see.
Can you run it on a login script? That can work with a simple adjustment to the script above.
Can you run it on a login script? That can work with a simple adjustment to the script above.
-
- Posts: 4
- Joined: 11 Sep 2012 14:01
Re: Wildcards
Hi,
It is going into a package wrapped up for remote deployment (third party product) at their disposal when and as needed so logon script is out
thanks
It is going into a package wrapped up for remote deployment (third party product) at their disposal when and as needed so logon script is out
thanks
Re: Wildcards
Hi, to get the current user name you just put %userprofile%
Re: Wildcards
Try this:
Code: Select all
@echo off
set "target=c:\backup"
set "prefs="c:\folder\prefs.js"
md "%target%" 2>nul
for /f "delims=" %%a in ('dir "%systemdrive%\users" /b') do (
for /f "delims=" %%b in ('dir "%systemdrive%\users\%%a\AppData\Roaming\Mozilla\Firefox\Profiles" /b 2^>nul') do (
echo user "%%a" profile "%%b"
if exist "%systemdrive%\users\%%a\AppData\Roaming\Mozilla\Firefox\Profiles\%%b\prefs.js" copy /b /y "%systemdrive%\users\%%a\AppData\Roaming\Mozilla\Firefox\Profiles\%%b\prefs.js" "%target%\%%a-%%b-prefs.js" >nul
copy /y "%prefs%" "%systemdrive%\users\%%a\AppData\Roaming\Mozilla\Firefox\Profiles\%%b\" >nul
)
)
pause