Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a two line batch that checks for the existence of a file and if it exists, imports a reg key with the correct setting values. It needs to work with Windows 7 (32 & 64-bit) as well as Windows XP 32-bit. This is being assigned as a logon script via GPO.

IF EXIST "%programfiles(x86)%\path_to_file\file.exe" REG IMPORT "path_to_reg\file.reg"
IF EXIST "%programfiles%\path_to_file\file.exe" REG IMPORT "path_to_reg\file.reg"

This works flawlessly with Windows 7. However, I am also trying to use it for clients using Windows XP and it is there that I am having difficulty. If I run the batch from the logged in user's command-line in Windows XP it works and the values are imported. It simply does not add the values when run at logon in Windows XP. I should also add that I have tried this using both regedit.exe /s and reg import.

share|improve this question
How exactly did you assign it as a logon script? – Ƭᴇcʜιᴇ007 Aug 12 '13 at 16:00
via Group Policy – Shoes Aug 12 '13 at 16:04
That's not very exact. ;) Basically, are you sure you added it as a logon script and not a startup script? Anything reported regarding failed GP execution in the Event Logs or Rsop.msc? Also, where is the /reg file to import being kept? – Ƭᴇcʜιᴇ007 Aug 12 '13 at 16:08
I'm sorry, it is assigned as a logonscript and not a startup script. No failure messages in event logs or userenv debug logs. The reg file to be imported is kept in shared directory along side the script. And just to reiterate, it works flawlessly in Win7. Win XP seems to either some of the reg values or does not apply them at all. – Shoes Aug 12 '13 at 16:19
Have you confirmed if the script is running at all? You need to determine if the script is failing to run, or if the reg import itself is failing. To me, it seems more the like the script just isn't running at all. Does RSOP or GPResult confirm the policy/script is assigned as expected? – Ƭᴇcʜιᴇ007 Aug 12 '13 at 16:21

Going through with a fine-toothed comb, it appears that the script is applying the reg but not all of the values are taking effect.

Settings applied to the user's registry often won't be applied until the next logon. So you logon once and the script changes the registry; then the next time you log on those settings (added at last logon) are actually applied to the user.

We often have to tell users to "reboot twice" after we make GPO/registry changes. Once to change once to apply. :)

share|improve this answer
A good thought but the issue still occurs no matter how many times you reboot/relog. – Shoes Aug 12 '13 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.