Page 1 of 1

Batch file to update regisrty

Posted: 29 Jun 2012 06:45
by tuts73
Hi All just wondering if you can help - i need to update the registry and add some keys and dword values...this works as a .reg file to update the registry but i need it to work in a batch script

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel]

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security]

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security\FileValidation]
"EnableOnLoad"=dword:00000000


[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Word]

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Word\Security]

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Word\Security\FileValidation]
"EnableOnLoad"=dword:00000000

Thanks in advance :)

Re: Batch file to update regisrty

Posted: 29 Jun 2012 06:59
by foxidrive
reg.exe can help you there.

You just have to add these

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security\FileValidation]
"EnableOnLoad"=dword:00000000

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Word\Security\FileValidation]
"EnableOnLoad"=dword:00000000

Re: Batch file to update regisrty

Posted: 29 Jun 2012 07:03
by tuts73
thanks dude - will give it a try

Re: Batch file to update regisrty

Posted: 29 Jun 2012 07:05
by foxidrive
An alternative is to use the regfile you already have - you will need admin permissions probably

Code: Select all

@echo off
regedit /s "c:\folder\myreg.reg"

Re: Batch file to update regisrty

Posted: 29 Jun 2012 11:50
by e4nd
Not tested :wink:
1.

Code: Select all

@echo off
::
set EXCEL=HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security\FileValidation
set WORD=HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Word\Security\FileValidation
::
REG ADD "%WORD%" /V EnableOnLoad /T REG_DWORD /F /D 0 >nul
REG ADD "%EXCEL%" /V EnableOnLoad /T REG_DWORD /F /D 0 >nul

2.

Code: Select all

@echo off
(
echo Windows Registry Editor Version 5.00
echo.
echo [HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security\FileValidation]
echo "EnableOnLoad"=dword:00000000
echo.
echo [HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Word\Security\FileValidation]
echo "EnableOnLoad"=dword:00000000
)>>"%Temp%.\regfile.reg"
::
Regedit /s "%Temp%.\regfile.reg" >nul
"%windir%\regedit.exe" /s "%Temp%.\regfile.reg" >nul
Del /F /Q "%Temp%.\regfile.reg" >nul