I am tring to use variables within a batch file, where I have a config file that has multiple configurations, an example of my configuration file format is:
PROCESS=<ftpSiteURL> <username> <rd> <lcd>
where the data may be:
FTP=ftp.siteA.com asmith ftpFolder localFolder
FTP=ftp.siteB.com asmith ftpFolder localFolder
FTP=ftp.siteC.com asmith ftpFolder localFolder
From the question How to read file contents into a variable, I have determined that I can read each line from the file (ftp.txt), into a parameter, using:
for /f "delims== tokens=1,2" %%X in (ftp.txt) do (
SET %%X=%%Y
)
I have also read How to split a string by spaces, from which I can split a string into the required variables:
for /f "tokens=1,2,3,4" %%a in ("ftp.one.com asmith ftpFolder localFolder") do (
SET SITE=%%a
SET USER=%%b
SET REMOTE=%%c
SET LOCAL=%%d
)
My questions:
I get nothing, if I ECHO the created variable FTP; trying:
%FTP
%%FTP
%FTP%
%%FTP%%
What is the correct syntax to ECHO the content of the FTP variable, as this needs to replace the hard-coded string in the second FOR LOOP?