• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Runonce with batch

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
27,695 (3.84/day)
Location
Alabama
System Name RogueOne
Processor Xeon W9-3495x
Motherboard ASUS w790E Sage SE
Cooling SilverStone XE360-4677
Memory 128gb Gskill Zeta R5 DDR5 RDIMMs
Video Card(s) MSI SUPRIM Liquid 5090
Storage 1x 2TB WD SN850X | 2x 8TB GAMMIX S70
Display(s) 49" Philips Evnia OLED (49M2C8900)
Case Thermaltake Core P3 Pro Snow
Audio Device(s) Moondrop S8's on Schitt Gunnr
Power Supply Seasonic Prime TX-1600
Mouse Razer Viper mini signature edition (mercury white)
Keyboard Wooting 80 HE White, Gateron Jades
VR HMD Quest 3
Software Windows 11 Pro Workstation
Benchmark Scores I dont have time for that.
Hey guys need some quick help here. i need to add a reg key to a batch file I will be making but I cant get it to work right. its a run once key. I can manually make the key no problem but when trying to add it via batch well im not super versed with adding registry keys with batch so im having a hard time understanding the syntax needed. Here is the original key as iv dumped from the registry after I made it. I need this key to be put into registry via batch (add reg) can anyone help?

Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"Message"="MSG * THIS IS THE MESSAGE"
 
sl;ight bump
 
running as admin wont be an issue but my biggest issue is that the batch may not always be run with the .reg present.
 
What do you mean ? You could create the reg file from the batch file, writing to tmp
 
What do you mean ? You could create the reg file from the batch file, writing to tmp

I suppose I can try this and report my success. I only mentioned add reg because I have the batch doing other things and it seemed simple to just include 1 or 2 lines to write the entry.
 
I managed to do it via 1 line in batch the code is as follows. for a standard message via runonce

Code:
Reg Add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v Message /d "MSG * YOUR MESSAGE" /f

obviously change HKLM to HKCU for the user of your choice instead.
 
Back
Top