我想在 go-to-loop 中执行带有选项的脚本,如下所示:
@echo off
rem my Array to loop thru
set Arr[0]=foo
set Arr[1]=bar
set Arr[2]=baz
set Arr[3]=bing
set Arr[4]=bang
@肯·怀特(Ken White)发表评论后:
for /l %%x in (1, 1, 4) do (
set VAR=%%Arr[%%x]%%
"C:\Program Files (x86)\WinSCP\winscp.com" /ini=nul /script=C:\Dev\Automated_FTP_Scripts\%VAR%
rem works as echo:
call echo "C:\Program Files (x86)\WinSCP\winscp.com" /ini=nul /script=C:\Dev\Automated_FTP_Scripts\%VAR%
)
它 still 不断返回以下错误:Cannot open file "C:\Dev\Automated_FTP_Scripts\%Arr[0]%"
如果我执行call echo ...
,则会显示出正确的路径...
我尝试了不同的事情:
set VAR=C:\Dev\Automated_FTP_Scripts\ + %%me%%
set VAR="C:\Dev\Automated_FTP_Scripts\ + %%me%%"
set VAR=C:\Dev\Automated_FTP_Scripts\%%me%%
set VAR="C:\Dev\Automated_FTP_Scripts\%%me%%"
"C:\Program Files (x86)\WinSCP\winscp.com" /ini=nul /script=%%Arr[%%x]%%
问题:如何将all_path
传递给winscp
选项/script
?
一个问题是我不知道该如何使用Google;我总是得到有关如何将参数传递到.bat文件的结果