Discussion Locked

Editing the registry using a batch file?

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to write a batch file for a faculty member that will launch Internet Explorer in "Work Offline" mode. I have read that this setting has to be altered using the registry.

Is there any way to change this setting using a .bat file? If so how do I go about it, or where cna I find more information on the subject. Thanks very much.

Brad Morgan
Multimedia Technician

9 replies

by sixfourtykilo

You can have a batch file call the regedit.exe command followed by an exported key (preferrably the key you want imported) contained in a .reg file.

EX: REGEDIT FILE.REG

by joseph moore

To add to the above answer:

Yes, calling REGEDIT filename.REG is the correct syntax for using a Registry file in a logon script. Now, to make it run with no user intervention (so the Registry file is imported into the destination Registry withoutthe user being prompted to accept the modification) add the /S switch. So, to import a .REG file called IE.REG by login script, put the following in the script:

CALL REGEDIT /S IE.REG

That is all there is. Just keep the .REG file in the Netlogon share on the PDC (or in the Sysvol share on a Win2K DC), and that will do it.

by joseph moore

BTW, here is the Registry location to force IE in Work Offline mode:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Internet Settings
Change the value of GlobalUserOffline to 1 to for IE in Work Offline Mode

So, to be technical, this is what your .REG file will contain (I am exporting this from Win2K; a WinNT box will have a different file header):

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"GlobalUserOffline"=dword:00000000

by joseph moore

Oh, I should say that the above Registry will set IE in normal mode. For Work Offline mode use this:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"GlobalUserOffline"=dword:10000000

by jcprince

MS have listed this in their knowledge base - see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q180946.

In terms of using a batch file, have you tried using the Windows Scripting Host. This enables you to write changes to the registry.The 3 lines below should be copied into a text file & saved with a vbs extension. Then double click the file.

Set WSHShell = WScript.CreateObject("WScript.Shell")
offline_true = WSHShell.RegWrite("HKCU\Software\Software\Microsoft\Windows\Current Version\Internet Settings\GlobalUserOffline",1,"DWORD")
set WSHShell = nothing

This discussion is closed to new replies.