Question : FTP - How to use variables

Hi,

Was wondering if there is a way to use variables in my text file?  I declare variables in my batch by calling my 'setenv.cmd' file with all the declarations.  Then in the .bat file I have a line:

ftp -i -s:cfm_ftp_script.txt

Then my cfm_ftp_script.txt file looks like below.  I want to use the variables for 'server' 'ftpuser' etc..... Can I do that?  I tried wrapping them with % and also prefix with $ but neither worked...

open server
ftpuser
ftppwd
lcd d:\hyperion\cfm
cd ..
cd ..
cd essbase111
ls -al
asc
get cfm_extract.txt
bye

Answer : FTP - How to use variables

What is in your "setenv.cmd" ?  What you need to it basically like has been said above.  I imagine you need:

@Echo off
setlocal
REM Save this as ftpscript.cmd or something
call setenv.cmd
rem Assuming now you have done in there set username= set password= etc.
echo %date% %time% Creating a script file in the temp dir
(echo open %server%
echo %username%
echo %password%
echo lcd %downloadpath%
echo cd ..
echo cd ..
echo cd essbase111
echo ls -al
echo asc
echo get cfm_extract.txt
echo bye ) > "%temp%\ftpscript.txt"
echo %date% %time% Now executing FTP
ftp -i -s: "%temp%\ftpscript.txt"
echo %date% %time% Completed
Random Solutions  
 
programming4us programming4us