英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论