Jump to content

RunOnce & manual execution differ? WTF?


Recommended Posts

I'm going crazy here... I have one batch script, which, when run at HKEY_CURRENT_USER\...\RunOnce, does have another behaviour than when run manually. WTF? It's a sample batch script. Just some registry imports and file moves (if they aren't moved already).

As long as the global variables aren't different, this can't be, can it?

This is madness...

And, Leonidas, you're not helping very much... even if "THIS IS SPARTAAA!" :P

Has anyone else seen or heard of this monstrosity? ;)

Edited by BAReFOOt
Link to comment
Share on other sites


Some tweaks/file-edits only works after explorer.exe has been fully loaded, since e.g. some imported reg-entries gets overwritten later on, etc...

If this is the problem you're having, then i have done alot of tests of this, and found that it can be fixed by defining one or more entries in 'HKLM\[...]\RunOnceEx', in addition to adding the batch/reg-file with the problematic entries to be run from 'HKCU\[...]\RunOnce'.

This will then make 'HKLM\[...]\RunOnceEx' run first and then afterwards explorer.exe and 'HKCU\[...]\RunOnce' loads up.

Sometimes however, then it still dosen't work(as it still is a couple of seconds to fast), and in that case, then i have found that it can be fixed by also adding a pause in the beginning of the batchfile, like e.g. something like this :

ping -n 1 -w 4000 1.1.1.1

(this is a pause of 4 secs, so adjust the '4000' as you please...).

Link to comment
Share on other sites

===== Post Nº 1 =====

why dont you post your code on here for people to look at, may help you get a reply.

Because I don't want to. It's pretty internal stuff that shouldn't get into the net.

But it's just some registry imports for explorer, winlogon & lsa, internet settings, internet explorer, keyboard, desktop & folder settings, then some rearranging of the start menu items and deletion of unwanted files. If you can expect that there is no difference in how a registry key is written and stored, then this should not differ.

Besides, everything except the registry changes works fine. Even on a user-specific basis.

That's why I'm baffled. Registry keys get ignored for no reason.

===== Post Nº 2 =====

Some tweaks/file-edits only works after explorer.exe has been fully loaded, since e.g. some imported reg-entries gets overwritten later on, etc...

Ah, that's interesting, because I thought RunOnce runs only when explorer.exe has finished loading 100%. It's worth a try. :) Thank you!

If this is the problem you're having, then i have done alot of tests of this, and found that it can be fixed by defining one or more entries in 'HKLM[...]RunOnceEx', in addition to adding the batch/reg-file with the problematic entries to be run from 'HKCU[...]RunOnce'.

Here comes the funny part: I'm already doing this. It fact I began with RunOnceEx, and only added "HKCU...RunOnce" after I found out about "Active Setup", and that this does not make it better too. So I guess the keys get overwritten even after RunOnceEx, Active Setup and RunOnce. That's where i began to get stuck. Now your idea from above could help...

Sometimes however, then it still dosen't work(as it still is a couple of seconds to fast), and in that case, then i have found that it can be fixed by also adding a pause in the beginning of the batchfile, like e.g. something like this :

ping -n 1 -w 4000 1.1.1.1

(this is a pause of 4 secs, so adjust the '4000' as you please...).

Lol. What a dirty, dirty hack for a delay function. ;) But it's a nice idea. :)

Because, this could finally solve it. Let's see... starting new installation in ...3 ...2 ...1 ...

===== Post Nº 3 =====

ping -n 1 -w 4000 1.1.1.1

Just a quick note: 1.1.1.1 does not work. ping does not wait at all.

But with 3.3.3.3 or 111.111.111.111 it does work. Until someone takes the adress. ;)

Oh, and 192.168.254.0 or 0.0.0.1 work too (and make more sense, if there is any... ;))

Edited by Yzöwl
Link to comment
Share on other sites

@ BAReFOOt - Please do not continue to multipost without reply, I have removed your unnecessary bump and merged your series of three posts into one.

As a side note, if you feel that you don't want to give us the failing code in order to tie down your problems then don't expect us to want to help!

Link to comment
Share on other sites

Ah, that's interesting, because I thought RunOnce runs only when explorer.exe has finished loading 100%.

Yeahh, i've read that too, but it isn't true, though, as it needs a preceding key executed for that to happen...

Just a quick note: 1.1.1.1 does not work. ping does not wait at all.

But with 3.3.3.3 or 111.111.111.111 it does work. Until someone takes the adress. ;)

Oh, and 192.168.254.0 or 0.0.0.1 work too (and make more sense, if there is any... ;))

Hmm, it works perfectly here on both XP and Win2K, but it will only work if there isn't a '1.1.1.1' address available, as if there are, then you need to change the address to a non-existing one, just like you did...

Btw, Another version is :

ping -n 5 127.0.0.1

Where '-n 5' is 5 secs.

Link to comment
Share on other sites

Oh goly, what a dirty way to pause a batch file! Just use the sleep.exe that can be found in the Windows Server 2003 resource kit. It works just like the sleep command on linux:

sleep n

where n is a number of seconds, and it then waits for n seconds before continuing. Much cleaner.

Link to comment
Share on other sites

I'm perfectly aware of 'sleep.exe', but the point of (ab)using ping for pausing a batchscript, is that you'll archive the exact same functionality, without needing to add an additional tool to your unattended CD...

Link to comment
Share on other sites

Please do not continue to multipost without reply, I have removed your unnecessary bump and merged your series of three posts into one.
What series of three posts? I've just done one "bump" post, because sometimes a thread goes under in the others, and it would be extremely stupid to let it just die then, because why write it in the first place when you don't care?

But I heard there are levels of alcohol that make 3 things out of two (just before you see double). ;)

As a side note, if you feel that you don't want to give us the failing code in order to tie down your problems then don't expect us to want to help!
I *repeat*: The exact code is perfectly *irrelevant*. But maybe others are so stupid, that you expect that there's crap in the code that's not mentioned by the user. I tell you something: Pleast disable retard mode by default. ok? Then if you're to disgusted by those that drive you crazy, rather go somewhere where it's better, than enablang retard mode by default. Would be nice. Thank you.

Now imagine my code as this:

reg import "desktop.reg"
reg import "taskbar.reg"
reg import "explorer.reg"
reg import "control panel - accessibility.reg"
reg import "control panel - internet.reg"
reg import "control panel - user accounts.reg"

rd /s /q crapdir1
rd /s /q crapdir2
rd /s /q crapdir3
del /s /q *.crap
del /s /q crap.*
del /s /q *.crap.*

(of course this are NOT the real files [oh god, why do i think you'd really tell me this?])

And to mention it AGAIN: They The script is proven in YEARS of tests and usage with manual execution.

Just now when i run it in RunOnceEx, Active Setup or RunOnce, the registry settings don't get included. (While the files get deleted without problems when ran in RunOnce or Active Setup [in RunOnceEx Active Setup still has to create some of them].)

If that is "not enough information for you", then just leave us alone, ok?

Link to comment
Share on other sites

When do the registry values of explorer.exe for the new user get created (as seen from reg or regedit)?

My expectation is: They already exist in the default user, but some get added trough Active Setup.

What I begin to fear: On the first EXIT of explorer.exe.

I tell you... one more such thing and i'll throw that whole thing away, kill my xp partition and go with gentoo only... I did not realize what an incredibly poor child's OS XP is, until I saw this mess from the inside...

Link to comment
Share on other sites

If i where you, then i would try it one last time with a RunOnceEx --> RunOnce run, and with a 10 secs pause in the beginning of the RunOnce batchscript...

If you allready have tried with such a big pause, then please disregard this :)

Edited by Martin H
Link to comment
Share on other sites

Please do not continue to multipost without reply, I have removed your unnecessary bump and merged your series of three posts into one.
What series of three posts? I've just done one "bump" post, because sometimes a thread goes under in the others, and it would be extremely stupid to let it just die then, because why write it in the first place when you don't care?

But I heard there are levels of alcohol that make 3 things out of two (just before you see double). ;)

As a side note, if you feel that you don't want to give us the failing code in order to tie down your problems then don't expect us to want to help!
I *repeat*: The exact code is perfectly *irrelevant*. But maybe others are so stupid, that you expect that there's crap in the code that's not mentioned by the user. I tell you something: Pleast disable retard mode by default. ok? Then if you're to disgusted by those that drive you crazy, rather go somewhere where it's better, than enablang retard mode by default. Would be nice. Thank you.

Now imagine my code as this:

reg import "desktop.reg"
reg import "taskbar.reg"
reg import "explorer.reg"
reg import "control panel - accessibility.reg"
reg import "control panel - internet.reg"
reg import "control panel - user accounts.reg"

rd /s /q crapdir1
rd /s /q crapdir2
rd /s /q crapdir3
del /s /q *.crap
del /s /q crap.*
del /s /q *.crap.*

(of course this are NOT the real files [oh god, why do i think you'd really tell me this?])

And to mention it AGAIN: They The script is proven in YEARS of tests and usage with manual execution.

Just now when i run it in RunOnceEx, Active Setup or RunOnce, the registry settings don't get included. (While the files get deleted without problems when ran in RunOnce or Active Setup [in RunOnceEx Active Setup still has to create some of them].)

If that is "not enough information for you", then just leave us alone, ok?

Two things quickly!
  1. Don't argue with me unless I am either wrong or you are right!
    both scenarios are unfortunately not the case
    If you see in your post the additional emboldened headings, Post Nº 1, Post Nº 2 and Post Nº 3; I added them when I merged your 3 posts, posted one after the other without reply. You'll also notice the edited by bit to prove it's not a figment of my alcohol induced state!
  2. Don't then go ahead and do the same thing again!
    Can you see above this post where you have two concurrent posts both by yourself. I would suggest that one who ignores advice is one who shouldn't ask questions. Please try to learn to toe the line as a responsible Member of our Forums!

You've got a problem with registry settings not applying, you're asking for help but you cannot even be bothered to show us the registry settings etc. which aren't working for you. If you think yourself above us all in your skill level then why bother posting in the first instance.

Incidentally the scripted sample code you supplied is awful, I consider myself to be quite good with this sort of thing and really appreciate the way that you are attempting to belittle both myself in my role as a forum Moderator and the rest of the Board Membership with your current stance.

Link to comment
Share on other sites

@barefoot - perhaps if you'd made yourself perfectly legible in your first post, i don't see what the issue is with you supplying the reg files, just hash out any personal stuff, the fact is you asked for help but are unwilling to supply any real information.

why not put your script on, where you add the values for runonce, there may be a missing double slash \\ from the path or a missing quote "

cleanup.cmd

FOR %%I IN (%systemdrive%\cleanup\*.reg) DO REG IMPORT %%I

Oh and another thing, i'm far from stupid, you on the other hand talk in riddle & complete gibberish!!!!

Edited by devil270975
Link to comment
Share on other sites

If i where you, then i would try it one last time with a RunOnceEx --> RunOnce run, and with a 10 secs pause in the beginning of the RunOnce batchscript...

If you allready have tried with such a big pause, then please disregard this :)

Unfortunately i've tried it, and it did not help. butt thank you. :)

I'll find some solution... sooner or later...

--- stupid as f*** answer merging... WARNING... the stuff below this line is totally unrelated to the stuff above it ---

@barefoot - perhaps if you'd made yourself perfectly legible in your first post, i don't see what the issue is with you supplying the reg files, just hash out any personal stuff, the fact is you asked for help but are unwilling to supply any real information.

why not put your script on, where you add the values for runonce, there may be a missing double slash \\ from the path or a missing quote "

See my post below for an explanation. I like my job...

cleanup.cmd

FOR %%I IN (%systemdrive%\cleanup\*.reg) DO REG IMPORT %%I

Oh and another thing, i'm far from stupid, you on the other hand talk in riddle & complete gibberish!!!!

Hey, who said you're stupid?? I certanly don't know you well enough to judge this.

Now I'm interested to know, where I talked gibberish that's not the result of a loss in translation, a misunderstanding or missing information on your side (often results in things that look like riddles). Maybe you could even enlighten me with the knowledge that i seem to miss. Oh, and missing information or misunderstandings are never a bad thing. Ignoring them is. :) I'm always happy to fix my weakest points, so I can finally get above that IQ of 140. (Only two more points to go... :))

But I think I'll leave you now... I have to kill this partiton...

Edited by BAReFOOt
Link to comment
Share on other sites

Two things quickly!
  1. Don't argue with me unless I am either wrong or you are right!
    both scenarios are unfortunately not the case
    If you see in your post the additional emboldened headings, Post Nº 1, Post Nº 2 and Post Nº 3; I added them when I merged your 3 posts, posted one after the other without reply. You'll also notice the edited by bit to prove it's not a figment of my alcohol induced state!

Allright. :) I thought you meant the first post of this thread, because i could not imagine a reason for enforcing that one should post a set of answers an one posting.

But to clear things up, i hve two questions:

1. What happens if i start writing the first post, while somebody submits a new message, and then i want to answer to that message? Do you expect me to wait until another one has answered (if ever)? If not, what do you expect me to do then?

2. Is that server so weak that it gets problems from some more posts? If yes, then i have a tiny litte server that can handle them for you. :)

It just makes no sense... (I don't have to add "...to me" after evey scentence, because we're all intelligent poeple, do I?)

  1. Don't then go ahead and do the same thing again!
    Can you see above this post where you have two concurrent posts both by yourself. I would suggest that one who ignores advice is one who shouldn't ask questions. Please try to learn to toe the line as a responsible Member of our Forums!

Ok, you could not know that, but as i said above, at that moment i still thought the problem were my first post in this thread, not the ones below. I'll watch it now, if you absolutely must have it and it makes you sick for whatever strange reason that I am not told and don't get by myself.

You've got a problem with registry settings not applying, you're asking for help but you cannot even be bothered to show us the registry settings etc. which aren't working for you. If you think yourself above us all in your skill level then why bother posting in the first instance.

Incidentally the scripted sample code you supplied is awful, I consider myself to be quite good with this sort of thing and really appreciate the way that you are attempting to belittle both myself in my role as a forum Moderator and the rest of the Board Membership with your current stance.

I've no idea where you got that "belittle" thing from now. I can tell you that how ever you interpreted my messages: This is not what I think i have said in my messages. Additinoally it would make no sense, would it? It's not as if there is only one single dimension of knowledge. I'm sure your english is way better than mine, for example. :P

To be honest: Te reason i'm not asking you right now, to come off your high horse of "i'm right. you're wrong. period.", is that it may misunderstand you too and that i'm certain, that this would not make things better for anybody.

About the registry settings:

1. I CAN'T show you the registry settings. Yeah, physically i could. But I'd probably lose my job. (Even if the private data were removed). And if i remove everything that i'm not allowed to show, then the lesf suff would be useless and misleading.

2. It is absolutely irrelevant, what settings they are, isn't it? It's just a value that's written. When ran manually, it's written. When ran via RunOnceWhatever, it's written. And there it stays, until it gets overwritten or the system forgets it's existance. So the question is unrelated to what key/value it is. It's about when explorer.exe writes it's registry keys, and how to get to an execution hook that's after this writing, but before the user can work on his system. To be a generic solution, the speciifc key or value is not allowed to play any rule. Else it would not be generic and could come up again, as soon as I add another key.

Now let's not forget that little gift that i got from you "off the record":

This is an official warning, you have continued to post without reply even though you've been told not to do so. You are arguing with a Moderator in the open Forum and being generally discourteous.

Ah nice... now the personal attacs because you can't stand it. Our big brother would be proud.

But whatever. This is how I see it. And that's how you see it. It's just that I can not make any sense of your opinion. And you don't even care to help me make sense of it. Instead you prefer to punish me "because you can".

I think I explained you my view quite clearly to help you make sense to it. Now how about accepting other opinions too, for a change.

Be happy that you're in that situation. If I could punish you the same way, just because you have another opinion, that would suck pretty bad, would it?

And btw: I could NOT merge this message with the previous one, because ther were extremely unrelated and reading them woul mike no sense at all. And i don't know if there were nome additional messages (maybe even by you) that came in, in the 30 minutes it took to write this thing.

But as I said, lf I can, I'll do you the favor of merging them.

Now let's get back to whit this thread and this forum was about, instead of such irrelevant stuff...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...