Hello, I'm trying to write a .bat file that will copy a file to several directories based off of a file called commands.txt. On unix, I would just do this using a for loop. I'm new to .bat scripting and it seems to me that you can only pass one command at a time to the for command. Is this true? Is there an easier way to do this? Here's a syntax example of what I would like to do. Notice there are 3 commands at the end. Only the 1st gets executed.
FOR /F "tokens=1,2,3* delims=/ " %%i in (dirlist.txt) do echo cd %%i\%%j\%%k >> commands.txt echo cp %filename% >> commands.txt echo "file copied" >> commands.txt
Any help is greatly appreciated. Thanks in advance!
FOR /F "tokens=1,2,3* delims=/ " %%i in (dirlist.txt) do echo cd %%i\%%j\%%k >> commands.txt echo cp %filename% >> commands.txt echo "file copied" >> commands.txt
Any help is greatly appreciated. Thanks in advance!