![火狐自动化测试文件](https://i-blog.csdnimg.cn/blog_migrate/617a68570b4ba44f7f0823d0a6827cd8.png)
火狐自动化测试文件
![](https://i-blog.csdnimg.cn/blog_migrate/77b0be1815b50aafe1470c115295d5fe.png)
Your Firefox profile houses some pretty important stuff such as bookmarks, saved passwords and preferences which would be quite inconvenient to lose. As with any valuable data, your Firefox profile should be backed up regularly.
您的Firefox配置文件中包含一些非常重要的内容,例如书签,保存的密码和首选项,这很容易丢失。 与任何有价值的数据一样,应定期备份Firefox配置文件。
While you can always perform the backup manually or use an external tool (such as MozBackup or FEBE), each of these options have their own shortcomings and none are a true “set it and forget it” method. Our geek oriented solution to Firefox profile backups is to use a batch script which can be run at any time. Regardless of whether or not you have Firefox open, this script will capture your current Firefox profile and store it in a zip file for easy recovery.
尽管您始终可以手动执行备份或使用外部工具(例如MozBackup或FEBE),但是每个选项都有其自身的缺点,没有一个是真正的“设置后遗忘”方法。 我们针对Firefox配置文件备份的极客解决方案是使用可随时运行的批处理脚本。 无论您是否打开Firefox,此脚本都将捕获您当前的Firefox配置文件并将其存储在一个zip文件中,以便于恢复。
剧本 (The Script)
Overall, the script doesn’t do anything magical. It simply goes to the respective user’s Firefix profile folder and copies all the unlocked files to a temporary directory and finally creates a zip archive of the files. You will need to have the 7-Zip command line tool copied to a folder set in your Windows PATH variable in order for the zip process to complete.
总体而言,该脚本没有任何神奇的作用。 它只是转到相应用户的Firefix配置文件文件夹,然后将所有未锁定的文件复制到一个临时目录,最后创建这些文件的zip存档。 您需要将7-Zip命令行工具复制到Windows PATH变量中设置的文件夹中,以便完成zip处理。
@ECHO OFF TITLE Firefox Profile Backup ECHO Firefox Profile Backup ECHO Written by: Jason Faulkner ECHO SysadminGeek.com ECHO. ECHO. SETLOCAL REM Requires the 7-Zip command line tool (7za.exe) which can be downloaded at: REM http://www.7-zip.org REM This file should be placed in a folder in the PATH variable (i.e. C:Windows) REM Full path the the storage archive file (do not put in quotes) REM Make sure this directory path exists. SET BackupFileName=%USERPROFILE%DocumentsBackupFirefoxProfile.zip REM Leave everything below here alone SET TempBackupDir=%TEMP%Firefox_Profile SET TempBackupDirAction="%TempBackupDir%" IF EXIST %TempBackupDirAction% RMDIR %TempBackupDirAction% MKDIR %TempBackupDirAction% XCOPY "%APPDATA%MozillaFirefoxProfiles*" %TempBackupDirAction% /E /V /C /H /Y SET BackupFileName="%BackupFileName%" IF EXIST %BackupFileName% DEL /F /Q %BackupFileName% 7ZA a %BackupFileName% "%TempBackupDir%*" IF EXIST %TempBackupDirAction% RMDIR /S /Q %TempBackupDirAction% ENDLOCAL
@ECHO OFF TITLE Firefox Profile Backup ECHO Firefox Profile Backup ECHO Written by: Jason Faulkner ECHO SysadminGeek.com ECHO. ECHO. SETLOCAL REM Requires the 7-Zip command line tool (7za.exe) which can be downloaded at: REM http://www.7-zip.org REM This file should be placed in a folder in the PATH variable (i.e. C:Windows) REM Full path the the storage archive file (do not put in quotes) REM Make sure this directory path exists. SET BackupFileName=%USERPROFILE%DocumentsBackupFirefoxProfile.zip REM Leave everything below here alone SET TempBackupDir=%TEMP%Firefox_Profile SET TempBackupDirAction="%TempBackupDir%" IF EXIST %TempBackupDirAction% RMDIR %TempBackupDirAction% MKDIR %TempBackupDirAction% XCOPY "%APPDATA%MozillaFirefoxProfiles*" %TempBackupDirAction% /E /V /C /H /Y SET BackupFileName="%BackupFileName%" IF EXIST %BackupFileName% DEL /F /Q %BackupFileName% 7ZA a %BackupFileName% "%TempBackupDir%*" IF EXIST %TempBackupDirAction% RMDIR /S /Q %TempBackupDirAction% ENDLOCAL
安排备份 (Scheduling the Backup)
Once you have the script in place, you simply need to schedule it via the Windows Task Scheduler. You can use the graphical interface or via the command line tool, SchTasks, to easily set it to run daily for the current user:
一旦脚本到位,您只需要通过Windows Task Scheduler计划它。 您可以使用图形界面或通过命令行工具SchTasks轻松地将其设置为对当前用户每天运行:
SchTasks /Create /SC DAILY /TN BackupFirefoxProfile /TR %UserProfile%DocumentsScriptsBackupFirefoxProfile.bat /ST 09:00 /RU <UserName> /RP <Password>
SchTasks /创建/ SC DAILY / TN BackupFirefoxProfile / TR%UserProfile%DocumentsScriptsBackupFirefoxProfile.bat / ST 09:00 / RU <用户名> / RP <密码>
Important Note: The script makes reference to profile specific locations (%USERPROFILE% and %APPDATA%), so it is important the scheduled task runs as the respective user account you want to backup the Firefox profile for.
重要说明:该脚本引用了配置文件的特定位置(%USERPROFILE%和%APPDATA%),因此计划任务以您要为其备份Firefox配置文件的相应用户帐户运行非常重要。
局限性 (Limitations)
This script will pick up any unlocked file as part of the backup. When Firefox is open, a file named “parent.LOCK” is created and this file is not included in the backup. It is a zero byte, so bit-wise the profile backup can complete without including this file.
该脚本将提取所有未锁定的文件作为备份的一部分。 打开Firefox后,将创建一个名为“ parent.LOCK”的文件,并且该文件不包含在备份中。 它是一个零字节,因此按位配置文件备份可以完成而无需包含此文件。
Certain add-ons may also lock files while Firefox is open, but our testing has not found any instances where this is the case.
Firefox打开时,某些附加组件也可能会锁定文件,但是我们的测试未找到任何这种情况。
Download the 7-Zip Command Line Tool
Manually Backup a Firefox Profile
翻译自: https://www.howtogeek.com/52049/how-to-easily-automate-your-firefox-profile-backup-with-batch-files/
火狐自动化测试文件