| 1. |
Solve : adding lines to a output text file? |
|
Answer» I WANT to add line1 line2 line3 hard coded in the batch file to a text file. I need crlf after each line. for /F "delims==" %%A in (c:\abcftp\list.txt) do What do you expect this line to do? I want to be able to start with push/pull:push and add each line to a text file on a separate line. The var %%A is the file name and is also plugged into the text where it says filename=%%A. The script works but the text to the file is on one line. thanks muchThis line does nothing for /F "delims==" %%A in (c:\abcftp\list.txt) do for /F "delims==" %%A in (c:\nameftp\list.txt) do echo push/pull:push remotedirectoryname:ABC\EntryB\ filename:%%A remoteserverIP:123.123.123.5 userID:abcid passwd:password emailaddr:[emailprotected] newfilename: >> c:\ABCftp\%%A.xfr This works but it put everything on one line in the text file. I want it on separate lines in the text file. How do you add crlf or how do you write it to add each group on a line. example push/pull:push remotedirectoryname:ABC\Entry\Filename:%%A remoteserverip:123.123.123.5 the FOR command has 2 forms 1. SINGLE line for [...] %%V in (something) do [command] 2. Multiple line - NOTE parentheses! for [...] %%V in (something) do ( [command] [command] [command] [command] ) So... dir /B /O:n > c:\abcftp\list.txt for /F "delims==" %%A in (c:\abcftp\list.txt) do ( echo push/pull:push > c:\abcftp\%%A.xfr echo remotedirectoryname:abc\EntryB\ >> c:\abcftp\%%A.xfr echo filename:%%A >> c:\abcftp\%%A.xfr echo remoteserverIP:123.123.12.43 >> c:\abcftp\%%A.xfr echo userID:abcftpid >> c:\abcftp\%%A.xfr echo passwd:abctflhd >> c:\abcftp\%%A.xfr echo emailaddr:[emailprotected] >> c:\abcftp\%%A.xfr echo newfilename: >> c:\abcftp\%%A.xfr ) thank you it works |
|