Question Locked

Batch / Scripting Problem

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

Hi I have an issue with a batch file I have created for the purpose of setting the homepage (googlehome.bat) as below:

@echo off
set key=HKCU\Software\Microsoft\Internet Explorer\Main
set value=Start page
set data=%1
reg.exe add "%key%" /v "%value%" /d "%data%" /f
googlehome "http://www.google.com.au"

When run the home page sets to google correctly however the batch seems to remain stuck in a loop with "The Operation completed successfully" continuosly repeating on the screen.
Any advice would be appreciated I am not much of script/batch junkie.

5 replies

by rob miners

set key=HKCU\Software\Microsoft\Internet Explorer\Main
set value=Start page
set data=%1
reg.exe add "%key%" /v "%value%" /d "%data%" /f
googlehome "http://www.google.com.au"
goto end
:end

by bizzo

Looks like the reason it's stuck in a loop is because it's calling itself (see the last line). You'd be better off setting the data with the address rather than using a parameter, like this:

@echo off
set key=HKCU\Software\Microsoft\Internet Explorer\Main
set value=Start page
set data=http://www.google.com.au
reg.exe add "%key%" /v "%value%" /d "%data%" /f

by lowryda

Tried other suggestions from other users, this was the only one that worked. Thank you

by maxpowers410

Why not try and put an exit command in at the end?
That way it should just close the cmd when its finished.
goto end
:end
exit

This discussion is closed to new replies.