Batch file to update regisrty

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tuts73
Posts: 2
Joined: 29 Jun 2012 06:40

Batch file to update regisrty

#1 Post by tuts73 » 29 Jun 2012 06:45

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 :)

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file to update regisrty

#2 Post by foxidrive » 29 Jun 2012 06:59

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

tuts73
Posts: 2
Joined: 29 Jun 2012 06:40

Re: Batch file to update regisrty

#3 Post by tuts73 » 29 Jun 2012 07:03

thanks dude - will give it a try

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file to update regisrty

#4 Post by foxidrive » 29 Jun 2012 07:05

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"

e4nd
Posts: 12
Joined: 17 Mar 2012 02:28

Re: Batch file to update regisrty

#5 Post by e4nd » 29 Jun 2012 11:50

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

Post Reply