Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

For loop variables are not environment variables, hecne they are not propagated to child processes. You may store the loop variable value to env variable though using set shell command.
soly

for loop variable in winscp ftp script dont work

Dear friends
i am trying to automate winscp ftp session and i start as follow :


i got a DOS batch file .bat looks like
------------------------------------------------------
@echo off
set w=work
set m=macro
set a=test
FOR %%X IN (AAA BBB) DO (
"C:\Program Files\WinSCP\WinSCP.exe" /console /script="c:\winscpftp.txt"
/log="c:\log.log"
ECHO %%X
)
---------------------------------------------------------
note: the patch work well and the variable %X appearers in the echo command correctly

also note that the for loop variable is written %%X and not %X



and i got a winscp ftp script looks like
---------------------------------------------------------
option confirm off
open ftp://root:password@192.9.200.30
option transfer binary
cd /%w%/%m%/%a%
dir
get %X%
----------------------------------------------------------

when running the batch file it lunches the winscp console and it work well tell the point =====> get %X% and it return the error

Can't get attributes of file '%X%'.
File or folder '%X%' does not exist.

i try to modify the winscp script to be =====> get %%X but the same error appears

plz help me to get the right way to get the variable from the batch for loop

thank you all