/build/static/layout/Breadcrumb_cap_w.png

Active Setup: Batchfile is not adding registryfiles

I run a batchfile via active setup. This batch file is adding .reg-files to the HKCU of the user (folder view-settings, etc).
The batchfile does it's job when I run manually as an user. When it's been started by active setup, the registry keys are not applied. For debugging I added "echo 1 > %temp%\1.log", which showed that the batchfile was started and each command line (eg "regedit /s HKCU_Remove_recent_from_startmenu.reg) was started as well.
Anybody any ideas?

0 Comments   [ + ] Show comments

Answers (7)

Posted by: dugullett 12 years ago
Red Belt
1
64 bit?

Comments:
  • I had some trouble with this on one of our installs. I ended up creating an exe using Autoit that ran the reg keys. For whatever reason I had better luck running an exe rather the a reg file. Not sure if it was just my enviroment or not. - dugullett 12 years ago
Posted by: pjgeutjens 12 years ago
Red Belt
1
did you set your scripts working directory by starting it with

pushd "%~dp0"

If not, give it a try
Posted by: Daz 12 years ago
Orange Belt
1
If we assume that you batch file and the reg files are in the same folder, try the following batch file:

[--Snip Start--]
@echo off

Set CURRDIR=%~dp0
Set LOG_FILE=%Temp%\Log.log

REG.exe IMPORT "%CURRDIR%HKCU_Alle_Folders_visible.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_set_screensave_reactivation_password.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_explorer_statusleiste visible.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_systemscontrol_small_icons.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_windows_explorer_folder_options.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_Remove_recent_from_startmenu.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"
[--Snip End--]

Reg.exe gives a return code of 1 if it fails but regedit just returns zero in either case.

Hope this helps,
Daz.
Posted by: piyushnasa 12 years ago
Red Belt
1
use following in activesetup
reg.exe IMPORT \regfile.reg

Comments:
  • Thanks piyushnasa, this is what I needed. My Active Setup was hanging because a UAC prompt is triggering when using REGEDIT ADD but REG IMPORT gets around it. - Zecher 9 years ago
Posted by: pjgeutjens 12 years ago
Red Belt
0
regedit /s HKCU_Remove_recent_from_startmenu.reg

start by taking out the /s and see if you get any error messages.
Posted by: akki 12 years ago
4th Degree Black Belt
0
Can you post code snippet of your batch file??
Posted by: FerrisBueller 12 years ago
Senior Yellow Belt
-2
@dugullett: Yes, 64Bit
@pjgeutjens: You'll see nothing of that at all, cause the batch runs before the desktop is ready. When you redirect the output to a file (eg
regedit /s HKCU_Remove_recent_from_startmenu.reg > %temp%\logfile.log), it'll be empty
@akki: this is my batch:

[--Snip Start--]
@echo off
regedit /s HKCU_Alle_Folders_visible.reg
regedit /s HKCU_set_screensave_reactivation_password.reg
regedit /s HKCU_explorer_statusleiste visible.reg
regedit /s HKCU_systemscontrol_small_icons.reg
regedit /s HKCU_windows_explorer_folder_options.reg
regedit /s HKCU_Remove_recent_from_startmenu.reg
[--Snip END--]

Comments:
  • @FerrisBueller:
    1. Have you given the proper path as in
    "%alluserspath%\HKCU_Remove_recent_from_startmenu" in your batch file, i dont
    see this in you batch file.
    2. If possible give it a try through VBScript. - akki 12 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ