New
#71
Reg import "E:\Testing\Winver.reg"
&:: It will return an error if an error arises.
Regedit /s "E:\Testing\Winver.reg"
&:: It will return nothing even if an error arises.
Reg import "E:\Testing\Winver.reg"
&:: It will return an error if an error arises.
Regedit /s "E:\Testing\Winver.reg"
&:: It will return nothing even if an error arises.
Another test via a CMD script.
The output is shown below.Code:@echo off (Net session >nul 2>&1)||(PowerShell start -verb runas '%~0' &exit /b) For %%I In ("E:\Testing\*.reg") Do (Echo. Echo --^>"%%I" is going to be imported. Reg import "%%I" && CD.||pause)
The first error denotes "Access denied" due to insufficient privileges.Code:-->"E:\Testing\Metered Connections.reg" is going to be imported. ERROR: Error accessing the registry. Press any key to continue . . . -->"E:\Testing\System Properties.reg" is going to be imported. The operation completed successfully. -->"E:\Testing\Testing.reg" is going to be imported. ERROR: The specified file is not a registry file. You can import only registry files. Press any key to continue . . .
The second was due to the absence ofWindows Registry Editor Version 5.00
The process will be paused only if an error has arisen.
I just found that&& CD.
is unneeded and can be omitted from the last line of the script.
That works brilliantly @Matthew Wai, thank you.
I setup a Test.reg [without the Windows Registry Editor Version 5.00] and it gave me the expected ERROR.
This is the finished code . . .
I will have ago at setting up the same sort of thing for .bat [I mean .cmd] and .ps1 as I attempted to do in a previous post!Code:@echo off Set Folder=C:\Implementation Set Count = 0 (Net session >nul 2>&1)||(PowerShell start -verb runas '%~0' &exit /b) For %%j In ("%Folder%\*.reg") Do Set /A Count += 1 echo Processing [ Merging ] REG files . . . & echo. For %%i In ("%Folder%\*.reg") Do (echo. echo "%%i". Reg import "%%i" ||Pause) echo. & echo Processed [ Merged ] %Count% REG files successfully! & echo. & Pause
Thanks again!
Try the following one, which will give you another error: access denied.
PowerRun, third-party software, allows you access to modify the "dword" of "Ethernet".Code:Windows Registry Editor Version 5.00 [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost] "Ethernet"=dword:00000002
Thank so much Matthew Wai for all your expertise, it is appreciated.
I am pretty confident that ALL the .reg files will be OK anyway as they come from TenForums!
I have over a 100 .reg files now so the program will be extremely time saving and useful.
I really need one each for .bat and .ps1 files as I also have quite a lot of them now. Did you see my attempt at creating them in a previous post?
Thanks in advance!
I just ran your script in post #66 and got the following:
Code:Processing BAT file: "E:\Testing\Testing batch.bat". '/q' is not recognized as an internal or external command, operable program or batch file. Operations completed. Press any key to continue . . .