Actions > Write to File > breaking line / placing ENTER

It sounds simple enough but I cant get this work. what is the exact string that you use for this?

I tried (\r\n) , \r\n , ({\r\n}) , @{\r\n} with no luck.
I also tried 0D and 13 for ascii and hex with a combination of () and {} and I cant get it to work.
Im trying to do a line break after “got time value”.


@eaguirreepjIJX There is an issue in the current version with using line break in Write to file. We’ll fix it for future versions.

Thanks for the reply.
Im currently using notepad with keystrokes but the typing is slow. Is there a way to make the typing speed faster?

Just for others reference.
A workaround that I found would be to put a character after each string like an “@” symbol.
Before the bot finishes running, use the read file module to store all the text from the .txt file into a string.
Use the split string module to separate all strings by the character given. in this case “@”. and put into a list variable
Use the join strings modules to join the items on that list variable and separate elements by line break from the drop down menu.
Lastly, overwrite the .txt file using the write to file module with the variable containing the joint string from the step above.
It is 4 additional modules at the end of the code that seem to get the job done fine.


Yes, this works. Thanks for a workaround till we fix this issue.

Hi @ashapkina,

Please include BOT execution in windows locked mode. This would help a lot in saving automation hours.


@narendra_purTG We are developing a feature that would unlock the PC and execute the script - see more info here Running RPA on a system locked mode


I just upgraded to v1.4 and the above worked but I tried one more workaround (for my case more convenient).
I created

  • a file and put the new line character in (i.e. press enter when editing with notepad and save)
  • a variable to use as the newline(i.e. temp_nl).
    In the begging of the recording I read that file with “Read File” and save the file content in variable temp_nl.
    When I need to write a new line with “Write to File” I replace the \r\n (used in older versions) with the variable ${temp_nl}

@dimitriuZHkTsR Works great :+1: Thanks!

Hi Team,

I have created log file (.txt). In that I want to write 3 sentences line by line. But in 1.4 version its not working.

Please give me help how to type sentences line by line.

Note: Earlier version i.e 1.2 version I have tried it .using \r\n and its working. \r\n is used for next line.

Is there another way or command for type into next line?

Amol, you can find workarounds for this issue above in this thread.

Hi colleagues,
There is one more workaround.
In your recording you may create one String variable “br” supposed to contain breaking symbol. Then you may print it to a file or join with other strings were ever line break is needed.
The simplest way to populate “br” by breaking symbol I found is to use “Join Strings” action (just 1 action). There you will join empty “br” with “br”, choose “Windows line break (CR+LF)” as a separator and put result back to “br”. As a result only windows line break will be placed to “br”.



Does anyone know how to change line in the write to file option


@h01234567 you can find several workarounds for it in the posts above.

I wonder what the status is of the fix for this. Any plans to releasing the Write to File enhancement for being possible to break lines?

@brunoazev it is not in the near plans due to the low priority of this issue.

Thank you @ashapkina.
I’ve actually created a custom script to help with the logging.

Sharing here as it may be useful for the community.
Hope y’all like it.

    import java.text.SimpleDateFormat

        input = ['log_fullpath','log_message']
    def logMessage() {
    	File file = new File("${log_fullpath}")
    	def sdf_mmyyyy = new SimpleDateFormat("HH:mm:ss.SSS")
    	def now_string = sdf_mmyyyy.format(new Date())
    	file << (now_string) + (":") + "${log_message}" + ("\n")



1 Like

Thank you @brunoazev
I’m sure it will be helpful to a lot of users.

Do you mind if we add it to the code samples in the Knowledge Base?

1 Like

Not at all.
Please do it and if possible, share with me the link. :slight_smile:

I added some screenshots to the original posting in case you want to attach those to better showcase.

1 Like

Thanks a lot @brunoazev