Line break in batch file

66

Solution 1

This is the correct syntax, that works on my Windows XP machine:

FOR /F "tokens=4 delims=," %%G IN ("deposit,$4500,123.4,12-AUG-09") DO (  
@echo Date paid %%G 
@echo hiforbat ) 

This is the output:

Date paid 12-AUG-09
hi

Solution 2

As Dennis said, you can use the caret, but you mustn't have spaces at the start of the following lines:

FOR /F "tokens=4 delims=," %%G IN ("deposit,$4500,123.4,12-AUG-09") ^ 
DO ^ 
echo Date paid %%G

Otherwise it doesn't work. However, if you are willing to leave the DO in the original line, you can use parentheses to delimit a block

FOR /F "tokens=4 delims=," %%G IN ("deposit,$4500,123.4,12-AUG-09") DO (
   @echo Date paid %%G
)

Solution 3

You need a carat "^" for a line continuation character at the end of each line where commands are split.

FOR /F "tokens=4 delims=," %%G IN ("deposit,$4500,123.4,12-AUG-09") ^
DO ^
echo Date paid %%G
Share:
66

Related videos on Youtube

Author by

nedroid

Updated on September 17, 2022

Comments

  • nedroid 3 months

    How to access from xml file to values in other xml. I need to access to xml which was created by SharedPreferences and is in folder shared_prefs.

  • Graviton
    Graviton almost 13 years
    It doesn't seem to work: I got a DO ^ thing printed out and that was it.
  • Dennis Williamson
    Dennis Williamson almost 13 years
    It doesn't like any indentation or the @ sign apparently.
  • nedroid over 10 years
    Do you have any example? ..i don't find any usefull
  • Biard Kévin over 10 years
  • nedroid over 10 years
    Isn't it any easy solution like this but syntactically correct? <EditTextPreference . . . android:defaultValue="@data/data/com.myapp/shared_prefs/toa‌​stTime" . . . </PreferenceCategory> Works when you read from strings under values(folder) android:defaultValue="@strings/toeastTime"