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.




3039 posts

Uber Geek
+1 received by user: 1608

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
8020 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"




3039 posts

Uber Geek
+1 received by user: 1608

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.


 
 
 
 


Try Wrike: fast, easy, and efficient project collaboration software


3039 posts

Uber Geek
+1 received by user: 1608

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.


3280 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...



3039 posts

Uber Geek
+1 received by user: 1608

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.


3280 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?

3280 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.



3039 posts

Uber Geek
+1 received by user: 1608

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.


3280 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.



3039 posts

Uber Geek
+1 received by user: 1608

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.




3039 posts

Uber Geek
+1 received by user: 1608

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 »

Amazon launches the International Shopping Experience in the Amazon Shopping App
Posted 19-Apr-2018 08:38


Spark New Zealand and TVNZ to bring coverage of Rugby World Cup 2019
Posted 16-Apr-2018 06:55


How Google can seize Microsoft Office crown
Posted 14-Apr-2018 11:08


How back office transformation drives IRD efficiency
Posted 12-Apr-2018 21:15


iPod laws in a smartphone world: will we ever get copyright right?
Posted 12-Apr-2018 21:13


Lightbox service using big data and analytics to learn more about customers
Posted 9-Apr-2018 12:11


111 mobile caller location extended to iOS
Posted 6-Apr-2018 13:50


Huawei announces the HUAWEI P20 series
Posted 29-Mar-2018 11:41


Symantec Internet Security Threat Report shows increased endpoint technology risks
Posted 26-Mar-2018 18:29


Spark switches on long-range IoT network across New Zealand
Posted 26-Mar-2018 18:22


Stuff Pix enters streaming video market
Posted 21-Mar-2018 09:18


Windows no longer Microsoft’s main focus
Posted 13-Mar-2018 07:47


Why phone makers are obsessed with cameras
Posted 11-Mar-2018 12:25


New Zealand Adopts International Open Data Charter
Posted 3-Mar-2018 12:48


Shipments tumble as NZ phone upgrades slow
Posted 2-Mar-2018 11:48



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.