atp9
atp9

Reputation: 890

Reg command in batch file

I am trying to run a simple batch file with following line of codes in it but as soon as I trigger this batch file (either running it from command prompt or double clicking on it), it continuously runs. Like forever. I am just trying to modify existing key in registry using batch file to some specific value.

reg add "hkcu\control panel\desktop" /v ForegroundLockTimeout /d "0x30d40" /f /t REG_DWORD

exit

In order to stop execution when I am giving interrupt (Cntrl + C) it asks whether it should terminate execution of this batch file or not..

Can someone help to understand what is wrong with this code? I think it should stop execution once it updates registry key but that is not happening. It continuously prints line# 1 on screen.

Upvotes: 1

Views: 531

Answers (2)

foxidrive
foxidrive

Reputation: 41224

You've called the batch file reg.bat right?

Try regfile.bat

Upvotes: 2

n34_panda
n34_panda

Reputation: 2677

Try the following, this works for me:

reg add "HKCU\control panel\desktop" /v ForegroundLockTimeout /t REG_DWORD /d "0x30d40" /f 

It returns:

The Operation completed successfully.    

Obviously try saving that to your bat file and then run the batfile as usual.

Upvotes: 1

Related Questions