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.


Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

#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 :-)





I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.


Create new topic
Ragnor
8219 posts

Uber Geek

Trusted

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




Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #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






I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.


Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

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

Also fail:

"legalnoticetext"="Stuff
Other Stuff"

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




I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.




bazzer
3438 posts

Uber Geek

Trusted

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

Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

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





I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.


bazzer
3438 posts

Uber Geek

Trusted

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

bazzer
3438 posts

Uber Geek

Trusted

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

 
 
 

Cloud spending continues to surge globally, but most organisations haven’t made the changes necessary to maximise the value and cost-efficiency benefits of their cloud investments. Download the whitepaper From Overspend to Advantage now.
Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

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

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





I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.


bazzer
3438 posts

Uber Geek

Trusted

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

Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

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




I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.


Lias

5589 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

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




I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup.


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









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.