string concatenation in a for loop
Posted: 09 Jun 2010 12:48
I'm trying to build an FTP script where I don't have to store the userid and password. The below worked just fine EXCEPT that I now want to be able to transmit like 20+ files.
viewtopic.php?f=3&t=1078&p=3695&e=3695
I thought I'd save the file commands separately and use the -s option but that won't work as it doesn't log me on before it executes the script.
So then I thought I'd create a string of echo commands into a varaible and pass that but this isn't working. The echo that is inside of the for loop doesn't work. I wanted to do "set xx=%xx% %%G" so that I could concatenate a bunch of commands together but it doesn't appear to be retaining the value of xx between executions inside of the for loop
for /f "tokens=* delims=" %%G in (sourceftp.bat) do (
set xx=%%G
echo %xx% >>file.txt (this just gives me ECHO is on so that must mean xx is empty)
)
echo %xx% >>file.txt (this does give me the very last line of my input file)
pause
Is there another way to write a file w/o redirection? Is there a better way to concatenate my ftp statements into 1 long command string?
viewtopic.php?f=3&t=1078&p=3695&e=3695
I thought I'd save the file commands separately and use the -s option but that won't work as it doesn't log me on before it executes the script.
So then I thought I'd create a string of echo commands into a varaible and pass that but this isn't working. The echo that is inside of the for loop doesn't work. I wanted to do "set xx=%xx% %%G" so that I could concatenate a bunch of commands together but it doesn't appear to be retaining the value of xx between executions inside of the for loop
for /f "tokens=* delims=" %%G in (sourceftp.bat) do (
set xx=%%G
echo %xx% >>file.txt (this just gives me ECHO is on so that must mean xx is empty)
)
echo %xx% >>file.txt (this does give me the very last line of my input file)
pause
Is there another way to write a file w/o redirection? Is there a better way to concatenate my ftp statements into 1 long command string?