I have the following code in the batch-file:
@echo on
regedit.exe /S abc.reg
If I run it, I get an error.
I searched the google for this and found nothing. Can someone help me please? I tried: - removing /S (the I can read (of course) the errormessage - Run the file as administrator (I'm admin per default)
I am using windows 8. The erros message: "Cannot import C:\users....abc.reg". Error opening the file. There may be a disk or a file system error.
Both Files are in the same folder.
The problem was, that I handled the %~dp0 in a false way. %~dp0 stands for the default path, but you don't have to set a backslash after it!
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.