2016-07-29 72 views
0
FOR /F %a in (downloadlist.txt) DO (
SET url=%a 
&& SET suffix=%url:ftp://ftp.ncbi.nlm.nih.gov/genomes/all=% 
&& SET combined=%url%%suffix% 
&& SET a_link=%combined%%assembly% 
&& echo %a_link% 
&& SET t_link=%combined%%transcripts% 
&& SET cds_link=%combined%%CDS% 
&& SET p_link=%combined%%protein% 
&& WGET %a_link% 
&& WGET %t_link% 
&& WGET %cds_link% 
&& WGET %p_link% 
) 

我怎樣才能把它分成多行?這是我目前的,它不工作。我也嘗試使用^字符。我究竟做錯了什麼?Windows批處理不會讓我把多個「FOR」循環分成多行?

+0

不工作怎麼樣?你有錯誤信息嗎?它是否以錯誤的順序運行命令?什麼? –

+0

每當我嘗試在CMD中運行它,我會得到一個無效的語法錯誤。 – Ambushes

+0

使用'%% a'代替'%a'。%a僅適用於命令提示符。批處理文件在循環中需要雙精度% – npocmaka

回答

1

更換未知變量值組裝,成績單,CDS,蛋白質與你的真實的值,這個腳本保存到文件下的test.bat和CMD窗口中運行它。發佈確切的錯誤消息,如果有

@echo off 
setlocal enabledelayedexpansion 
set "assembly=1" & set "transcripts=2" & set "CDS=3" & set "protein=4" 
FOR /F %%a in (downloadlist.txt) DO (
    SET url=%%a 
    SET suffix=!url:ftp://ftp.ncbi.nlm.nih.gov/genomes/all=! 
    SET combined=!url!!suffix! 
    SET a_link=!combined!%assembly% 
    echo !a_link! 
    SET t_link=!combined!%transcripts% 
    SET cds_link=!combined!%CDS% 
    SET p_link=!combined!%protein% 
    WGET !a_link! && WGET !t_link! && WGET !cds_link! && WGET !p_link! 
) 
exit /b 
+0

@About如果該腳本適合您,請考慮通過點擊答案左側的「向上箭頭」和「選擇」標誌來選擇並接受本主題中的任何答案。 :) – sambul35