Wednesday, May 31, 2017

Run a .reg file in the same folder as the .bat file


The erros message: "Cannot import C:\users....abc.reg". Error opening the file. There may be a disk or a file system error.


If you want to run a .reg file in the same folder as the .bat file, just write it like this:
@echo on
REGEDIT /S "%~dp0ABC.reg"

This will run the file ABC.reg in the same folder.


If you wan't to run something in a subfolder, you have to do it like this:
@echo on
REGEDIT /S "%~dp0SUBFOLDER\ABC.reg"
The brackets ("") are only needed, if there are whitespaces in the pathname.

No comments: