ghoppe
Goto Top

BATCH Datei nach Sternchen-Ordner suchen

Hallo zusammen,
ich bin gerade dabei mir eine BAT-Datei zu basteln um die Profile vom Firefox per "Knopfdruck" kopieren zu lassen, dabei hänge ich gerade an eine besch... Situation fest.

set mozprof=%appdata%\Mozilla\Firefox\Profiles\*.default\bookmarkbackups
set mozbackup=j:\Mozillabackup
@echo **********************************************************
xcopy %mozprof%\*.* %mozbackup%\%Date%\*.* /C /Y /Q
goto :ende

Da sich Profilnamen ja immer unterscheiden hab ich versucht das mit einem "*" zu lösen.
set mozprof=%appdata%\Mozilla\Firefox\Profiles\*.default\bookmarkbackups

Leider ist das so nicht zu lösen.
Ich würde gerne auf dem Ordner bookmarkbackups die JSON-Dateien wegkopieren.
Hat jemand eine andere Idee?
OS: Windows 7

Content-Key: 240584

Url: https://administrator.de/contentid/240584

Printed on: April 19, 2024 at 17:04 o'clock

Member: Xaero1982
Solution Xaero1982 Jun 11, 2014 updated at 11:28:34 (UTC)
Goto Top
Moin,

wie wäre es mit einem:

set mozbackup=j:\Mozillabackup
@echo ********************************************************** 
for /f %%i in ('dir /b /a "%appdata%\Mozilla\Firefox\Profiles"') do xcopy "%appdata%\Mozilla\Firefox\Profiles\%%i\bookmarkbackups\*.*" "%mozbackup%\%date%\*.*" /C /Y /Q  
goto :ende

Gruß
Member: colinardo
Solution colinardo Jun 11, 2014 updated at 11:27:34 (UTC)
Goto Top
Hi,
an den Pfad kommst du indem du den Ordnernamen aus der Profiles.ini holst:
for /f "tokens=2 delims=/" %%a in ('type "%appdata%\Mozilla\Firefox\profiles.ini" ^| findstr /ei "\.default"') DO set profilefolder=%%a  
set "mozprof=%appdata%\Mozilla\Firefox\Profiles\%profilefolder%\bookmarkbackups"  
Grüße Uwe
Member: ghoppe
ghoppe Jun 11, 2014 at 11:27:54 (UTC)
Goto Top
Ich versteh es zwar nicht aber es hat geklappt Danke face-smile
Member: Xaero1982
Xaero1982 Jun 11, 2014 at 11:28:52 (UTC)
Goto Top
Und was jetzt? Gehen nämlich beide Möglichkeiten um dein Ergebnis zu bekommen...
Member: ghoppe
ghoppe Jun 11, 2014 at 11:37:33 (UTC)
Goto Top
Für die Windows 7-Büchse geht der Befehl von colinardo
Deinen werden ich mal für die XP-Büchse testen
Member: ghoppe
ghoppe Jun 11, 2014 at 11:45:15 (UTC)
Goto Top
Xaero1982 deiner scheint auf der XP-Büchse zu funktionieren face-smile

Danke euch beiden!
Member: colinardo
colinardo Jun 11, 2014 updated at 11:59:44 (UTC)
Goto Top
Zitat von @ghoppe:
Xaero1982 deiner scheint auf der XP-Büchse zu funktionieren face-smile
Zur Info: das Auslesen des Default-Profils aus der "profiles.ini" geht hier in einer XP-VM einwandfrei ...
Member: Xaero1982
Xaero1982 Jun 11, 2014 updated at 13:08:05 (UTC)
Goto Top
Zur Info:

Beide Möglichkeiten gehen sowohl unter XP als auch unter Windows 7.

Das sind einfach Standardpfade und die Batchbefehle sind ja nun auch schon etwas älter.
Member: ghoppe
ghoppe Jun 11, 2014 at 12:46:23 (UTC)
Goto Top
So schauts jetzt aus und funktioniert auch face-wink
@echo off

title Firefox Backup
ver > C:\temp\Betriebssystem.txt
find "6.1" c:\temp\Betriebssystem.txt  
if errorlevel 1 (goto :XP-W2k) else (goto :61)
:61
set mozbackup=j:\Mozillabackup
@echo **********************************************************
@echo Firefox Profile Sicherung Windows 7
@echo Ihre Firefox Einstellungen werden gesichert
@echo Dieses Fenster schliesst sich automatisch
@echo **********************************************************
for /f "tokens=2 delims=/" %%a in ({{comment_strings:6132892459}}) DO set profilefolder=%%a  
set "mozprof=%appdata%\Mozilla\Firefox\Profiles\%profilefolder%\bookmarkbackups"  
xcopy %mozprof%\*.* %mozbackup%\*.* /C /Y /Q 
goto :ende

:XP-W2k
set mozbackup=j:\Mozillabackup
@echo **********************************************************
@echo Firefox Profile Sicherung Windows XP
@echo Ihre Firefox Einstellungen werden gesichert
@echo Dieses Fenster schliesst sich automatisch
@echo **********************************************************
for /f %%i in ('dir /b /a "%appdata%\Mozilla\Firefox\Profiles"') do xcopy "%appdata%\Mozilla\Firefox\Profiles\%%i\bookmarkbackups\*.*" "%mozbackup%\*.*" /C /Y /Q   
goto :ende
 
:ende
del c:\temp\Betriebssystem.txt
cls
@echo **********************************************************
@echo. 
@echo Alles wurde erfolgreich gesichert
@echo.
@echo **********************************************************
Nochmal ein riesiges fixes Dankeschön face-wink