S
S
Sergo Zar2020-04-11 16:55:02
Windows Registry
Sergo Zar, 2020-04-11 16:55:02

How to make a line break when creating a file?

How can I make sure that when creating a file there are line breaks after ">"?

[HKEY_CLASSES_ROOT\.html\ShellNew]

"Data"="<!DOCTYPE html><html><head><meta http-equiv='Content-Language' content='ru'><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><meta name='viewport' content='width = device-width,height = device-height, initial-scale = 1'><link rel='stylesheet' href='1.css' type='text/css'></head><body><script src='1.js'></script></body></html>"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wisgest, 2020-04-12
@Sergomen

If using *.reg files, then you can use the 16th representation of the text (in UTF-16):

[HKEY_CURRENT_USER\TEST.TMP]
"text"=hex(1):48,00,65,00,6c,00,6c,00,6f,00,2c,00,0d,00,0a,00,77,00,6f,00,72,\
  00,6c,00,64,00,21,00,00,00

Or use other means. For example JScript:
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.RegWrite("HKEY_CURRENT_USER\\TEST.TMP\\text", "Hello,\r\nworld!");

But as far as your task is concerned, the file will be created in UTF-16 without BOM. I don't think this is what you need. But then using string data, even if line breaks are not needed, is inherently wrong. Just use a hex dump of the generated file:
"Data"=hex:48,65,6c,6c,6f,2c,0d,0a,77,6f,72,6c,64,21

Z
Ziptar, 2020-04-12
@Ziptar

\r\n не работает?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question