尝试复制FireFox书签

huangapple go评论56阅读模式
英文:

Try to copy FireFox bookmarks

问题

我正在尝试使用批处理文件复制我的Firefox书签并保存到一个目录中。
它不起作用
有什么想法吗?

cd %AppData%
for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call set var1=%%j
cd profiles%var1%
if exist d:\bookmarks\places.sqlite copy d:\bookmarks\places.sqlite

英文:

I am trying to copy my Firefox bookmarks with a batch file and save it on a directoy.
It does not work
any Idea?

  cd %AppData%
for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call set var1=%%j
cd profiles\%var1%
if exist d:\bookmarks\places.sqlite copy d:\bookmarks\places.sqlite 

答案1

得分: 0

Your loop is not correct. You'll only get the latest profile.

for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call set var1=%%j
cd profiles\%var1%
if exist d:\backupbookmarks\places.sqlite copy d:\backupbookmarks\places.sqlite

Instead do this:

for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call :profile %%j
rem other code
GOTO :EOF

:profile
pushd profiles\%1
if exist d:\backupbookmarks\places.sqlite copy d:\backupbookmarks\places.sqlite 
popd
GOTO :EOF
英文:

Your loop is not correct. You'll only get the latest profile.

for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call set var1=%%j
cd profiles\%var1%
if exist d:\backupbookmarks\places.sqlite copy d:\backupbookmarks\places.sqlite

Instead do this:

for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call :profile %%j
rem other code
GOTO :EOF

:profile
pushd profiles\%1
if exist d:\backupbookmarks\places.sqlite copy d:\backupbookmarks\places.sqlite 
popd
GOTO :EOF

huangapple
  • 本文由 发表于 2023年4月19日 22:21:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76055630.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定