Hoyo
Hoyo

Reputation: 1074

Windows 8 can't run Registry file via Batch

I'm trying to run a registry file silently in Windows 8 64 bit via the code given below in batch file but it doesn't work and when I run the registry file manually it works fine! Also note that it's working in Windows 7 and Windows XP! I just go this error after I installed Windows 8 64 Bit!

       @echo off
       regedit /s abc.reg

This is how I run the registry file via batch file! Let me know if anyone can solve this issue!

P.S: I've tried running the batch file with Admin Privileges but no luck!

Upvotes: 2

Views: 2847

Answers (3)

code-assassin
code-assassin

Reputation: 415

For windows 8 you can change the registry key values as shown below.

[HKEY_CLASSES_ROOT.bat] @="batfile"

[HKEY_CLASSES_ROOT.bat\PersistentHandler] @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\batfile\shell\open\command] @="\"%1\" %*"

Note: Deleting the "UserChoice" from "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.BAT\" works mainly in windows 7. You might not even find the .bat in FileExts for windows 8

Upvotes: 0

Abhijeet
Abhijeet

Reputation: 8771

Solve it by using window + r --> regedit Navigate to this location : "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.BAT\" And Delete "UserChoice" key

Upvotes: 1

Hoyo
Hoyo

Reputation: 1074

Solved the issue by locating to the Path of the file.

    @echo off
    SET myPath="%CD%\abc.reg"
    regedit /s %myPath%

Upvotes: 2

Related Questions