Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

Topic # 60646 29-Apr-2010 14:21
Send private message

Having trouble trying to import a string into the registry via a reg file when the string cointains EOL makers.

The key is HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system
The value is LegalNoticeText

This can be set via gpedit (Computer Configuration\Windows Settigns\Security Settings\Local Policies\Security Options\Interactive Login: Message text for users atetmpting to log on).

I can set a multiline, formatted string via gpedit with no problems. PC shows the correctly formatted string when users attempt to login. I can export that string via regedit, and it exports to a .reg fine. If I then delete the key, and try and import it, it fails to the the multi line nature. I've tried using both the default export, and manually editing the file so it's a single line with EOL markers in it. When viewed in regedit, the value (when its as it should be after beign set with gpedit) shows it as a single line with two of those little squares you see when it cant recognise/display the character. A hexedit of the export file shows that as being standard CR/LF.

Does anyone know of a way for me to import a multi line string into the registry via a .reg file that will work?

This is stumping me and pissing me off :-)





Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.


Create new topic
8025 posts

Uber Geek
+1 received by user: 387

Trusted
Subscriber

  Reply # 324730 29-Apr-2010 14:36
Send private message

Can you use carriage return new line special characters instead, eg: for new line \n and carriage return \r

So where you want the line break use something like:

="My First Line\r\nMy Second Line"




3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

  Reply # 324738 29-Apr-2010 14:43
Send private message

Tried it, doesnt like it. Cheers for teh suggestion thou.
"legalnoticetext"="Stuff" = works
"legalnoticetext"="Stuff \r\n Other Stuff" = fail






Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.




3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

  Reply # 324740 29-Apr-2010 14:45
Send private message

Also fail:

"legalnoticetext"="Stuff
Other Stuff"

"legalnoticetext"="Stuff *inserted ascii here*Other Stuff"




Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.


3282 posts

Uber Geek
+1 received by user: 208

Trusted

  Reply # 324745 29-Apr-2010 14:48
Send private message

Could you use a .vbs or something instead?

e.g.

Dim WshShell, bKey
Set WshShell = WScript.CreateObject("WScript.Shell")

Title = "Caption"
Text = "Line 1" & VbCrLf & "Line 2" & VbCrLf & "Line 3"

WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\LegalNoticeCaption", Title, "REG_SZ"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\LegalNoticeText", Text, "REG_SZ"

n.b. I didn't try this myself...



3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

  Reply # 324754 29-Apr-2010 14:56
Send private message

bazzer: my vb skills are abysmal but if I cant figure out a way via a .reg file i did plan to try that.





Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.


3282 posts

Uber Geek
+1 received by user: 208

Trusted

  Reply # 324764 29-Apr-2010 15:04
Send private message

I tried the above and it did work. It's a pretty straight forward script, so should be OK? Maybe .vbs doesn't feel as "safe" as .reg file? You can see the script doesn't do anything untoward.

I'm interested in your solution too. I wonder if it's a bug? I did find reference to /r being used for carriage return, but that doesn't seem to work. Maybe using hex?

3282 posts

Uber Geek
+1 received by user: 208

Trusted

  Reply # 324767 29-Apr-2010 15:05
Send private message

Eureka!

With a bit of playing around, I discovered that \n is the code you need to use. This inserts the CR/LF combo.



3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

  Reply # 324788 29-Apr-2010 15:37
Send private message

Bazzer: so you succesfully imported a reg file using \r? or via vbs?





Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.


3282 posts

Uber Geek
+1 received by user: 208

Trusted

  Reply # 324853 29-Apr-2010 17:33
Send private message

Neither. Well, the .vbs did work to as I mentioned in #324764, but as I said in #324767 you need to use \n rather than \r in the .reg file.



3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

  Reply # 325003 29-Apr-2010 22:15
Send private message

bazzer: Neither. Well, the .vbs did work to as I mentioned in #324764, but as I said in #324767 you need to use \n rather than \r in the .reg file.


I meant \n lol.. Cheers will try in the morning.




Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.




3241 posts

Uber Geek
+1 received by user: 1764

Lifetime subscriber

  Reply # 325249 30-Apr-2010 13:38
Send private message

I still couldnt get it working with \n, but theVB works fine so will use that. Cheers for the help.




Information wants to be free. The Net interprets censorship as damage and routes around it.

 

Thinking about signing up to BigPipe? Get $20 credit with my referral link.


Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Targus set sights on enterprise and consumer growth in New Zealand
Posted 13-Aug-2018 13:47


Huawei to distribute nova 3i in New Zealand
Posted 9-Aug-2018 16:23


Home robot Vector to be available in New Zealand stores
Posted 9-Aug-2018 14:47


Panasonic announces new 2018 OLED TV line up
Posted 7-Aug-2018 16:38


Kordia completes first live 4K TV broadcast
Posted 1-Aug-2018 13:00


Schools get safer and smarter internet with Managed Network Upgrade
Posted 30-Jul-2018 20:01


DNC wants a safer .nz in the coming year
Posted 26-Jul-2018 16:08


Auldhouse becomes an AWS Authorised Training Delivery Partner in New Zealand
Posted 26-Jul-2018 15:55


Rakuten Kobo launches Kobo Clara HD entry level reader
Posted 26-Jul-2018 15:44


Kiwi team reaches semi-finals at the Microsoft Imagine Cup
Posted 26-Jul-2018 15:38


KidsCan App to Help Kiwi Children in Need
Posted 26-Jul-2018 15:32


FUJIFILM announces new high-performance lenses
Posted 24-Jul-2018 14:57


New FUJIFILM XF10 introduces square mode for Instagram sharing
Posted 24-Jul-2018 14:44


OPPO brings advanced technology to the smartphone market with new device
Posted 24-Jul-2018 09:20


Hawaiki Transpacific cable ready-for-service
Posted 20-Jul-2018 11:29



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.