I wrote the following batch file, but it does not work exactly as expected.
When the first record in the CSV file is processed, it displays the "echo" commands under :PRINTVARS, but subsequent loops don't. In addition, the _folderName variable is loaded with the correct value for the first record in the CSV file, but it doesn't update with the value of the next value in the CSV file...it keeps the value from the first record.
I could use some help. Any ideas?
:: Temporarily add plink to PATH
set PATH=C:\Program Files\Plink;%PATH%
:: Store input line into different variables
FOR /F "tokens=1-3 delims=," %%A IN (c7000-list.csv) DO (
:: Echo statements for troubleshooting & reviewing contents of variables
:: Make directories for each c7000 chassis along with a folder with today's date to store the c7000 config backups
:: Connect to SSH host and store key in cache
echo y | plink -ssh admin@%_oaIP% -pw <PWD> exit
:: Run Plink to backup OA config
plink.exe -m "D:\c7000_config_backups\ShowAllCmd.txt" -pw <PWD> admin@%_oaIP% >>".\%_folderName%\%date:~10,4%.%date:~4,2%.%date:~7,2%"\%_enclName%-OA-ShowAll.txt 2>>&1
:: Run VCSU to backup Virtual Connect config
"C:\Program Files (x86)\Hewlett-Packard Company\Virtual Connect Support Utility\vcsu.exe" -a configbackup -i %_oaIP% -u admin -p <PWD> -vcu admin -vcp <PWD> -l ".\%_folderName%\%date:~10,4%.%date:~4,2%.%date:~7,2%"\vcConfig-%_enclName%_vc_domain