LeveL Posted March 30, 2009 Share Posted March 30, 2009 I searched Google and this forum, nothing I have tried works.I want to add a reg entry under:HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceThis should be straightforward - just put this line in HIVESFT.INF where RunOnce appears:HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","MyEntry",0x00000000,"MyFile.bat"1 - MyFile.bat is already in %systemroot%\2 - It doesn't need the path, just referencing the bat file has worked in the past.I have been trying for hours now, over 2 days and nothing works.I put an INF file on the desktop that says:[Version]Signature = "$Windows NT$"[DefaultInstall]AddReg = StartRunOnce[StartRunOnce]HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","MyEntry",0x00000000,"MyFile.bat"But if I right click this INF and check in the registry under that key, the entry "MyEntry" is not there.I have tried every single way I can think now, searched Google, searched here, no one seems to have this problem.What do I need in the INF file to make it work?Be prepared for every single suggestion to fail by the way. Thats if anyone even has anything to suggest, theres only one way to do this and I have tried so many varied lines now, I must have used the correct syntax at least once! Link to comment Share on other sites More sharing options...
Noise Posted March 30, 2009 Share Posted March 30, 2009 The batch file needs to go in to %SystemRoot%\System32 if you don't want to specify a path. Link to comment Share on other sites More sharing options...
LeveL Posted March 30, 2009 Author Share Posted March 30, 2009 (edited) The batch file needs to go in to %SystemRoot%\System32 if you don't want to specify a path.Aside from that having nothing to do with it entering data under a reg key from an INF file, you're wrong anyway.It doesn't, it goes in %systemroot% and that doesn't need any path.I already know this looking for example at the file in my WINDOWS folder called "RTHDCPL.EXE" that is a program for my sound card - see, pathless and it does run...Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]"RTHDCPL"="RTHDCPL.EXE"Thats all that says plus I know it works because I have done it before, thats why I am doing it this way now.Please stop confusing things. Or don't reply if you don't know!But for now I am not even at that point and don't want to jump the gun here when the very initial thing isn't even working.Just downloaded this from RyanVM:[Tool] Reg2Inf converter v0.46http://www.ryanvm.net/forum/viewtopic.php?t=2169It gave me this converted to INF (from a reg file I know for certain does work to put the entry in, as a reg file)[Version]Signature = "$Windows NT$"[DefaultInstall]AddReg = REGEntries.AddReg[REGEntries.AddReg]HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","MyEntry",0x0,"MyFile.bat"Nice, the 0x00000000 has changed to 0x0, I had my hopes up there for a minute but guess what - does not work.Nothing anyone can suggest could make it work, I don't even know why I am asking. Thats not to say people here are daft I am saying there IS no answer.All I can think is the registry is broken, or locked down in some way even though I am the Administrator logged in as Administrator, why oh why isn't any of this working?I have tried countless times now right clicking an INF to "install" it into the registry and its not working.PS yes if I do "REG ADD" in a batch file that works perfectly, but even then the batch file is being deleted from the WINDOWS folder and I don't know why. Its supposed to run on next reboot not just vanish off the face of the earth, but nevermind, I am not even at that point yet, all I want to solve is this INF and to make it put the entry in.No, the answer isn't anything other than putting a line in HIVESFT.INF it must go there, please don't suggest anything else when this is what I need to do. People always say do this and do that but I tried it hours ago, or can't do it. Edited March 30, 2009 by LeveL Link to comment Share on other sites More sharing options...
iamtheky Posted March 30, 2009 Share Posted March 30, 2009 Is the batch file in place after install (just no execute), or did it not copy over at all? Link to comment Share on other sites More sharing options...
Noise Posted March 30, 2009 Share Posted March 30, 2009 [Version]Signature = "$Windows NT$"[DefaultInstall]AddReg = REGEntries.AddReg[REGEntries.AddReg]HKLM,%RunOnce%HKLM,%RunOnce%,"MyEntry",,"MyFile.bat"[Strings]RunOnce="SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" Link to comment Share on other sites More sharing options...
LeveL Posted March 30, 2009 Author Share Posted March 30, 2009 Thanks but I found out that the RunOnce key cannot "hold" an entry, thats why it does not appear there, it does appear but vanishes in like 0.00001 seconds.Im doing it under another key now and will just have to fix it later to stop it running on every reboot.So there you go - the RunOnce key might as well not be there because you can't add anything to it, not using an INF anyway. Link to comment Share on other sites More sharing options...
IcemanND Posted March 30, 2009 Share Posted March 30, 2009 When adding RunOnce keys via an INF install they are run immediately after the INF install completes. From: http://support.microsoft.com/kb/281820All RunOnce entries in the registry are run in the following cases: 1. At the end of installation through InstallFromHinfSection even in the cases where you must restart the computer. 2. After the default processing of DIF_INSTALLDEVICE even if you must restart the computer (with the exception of server-side processing). 3. After the system has been restarted.Further down the same page:Programs that must run once when the computer is restarted should be specified through RunOnceEx entries.You should be seeing one of two things when you run the INF you provided, either an error that myfile.bat is not a valid win32 application, or you see you bat file flash on the screen as it runs. Link to comment Share on other sites More sharing options...
iamtheky Posted March 30, 2009 Share Posted March 30, 2009 I never got the exclamation point trick to work with runonce, but placing it before your key is supposed to prevent deletion. Link to comment Share on other sites More sharing options...
LeveL Posted March 30, 2009 Author Share Posted March 30, 2009 OK thanks, yes I will probably switch to RunOnceEx at some point. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now