Kullenen_Ask Posted December 10, 2013 Posted December 10, 2013 (edited) I will have a "X:\Program Files\RegImport\" folder. In this folder there will be files "1.reg", "2.reg", "3.reg" etc.I want to run a Autorun.cmd and call it at boot and i want it to register the files in that folder. Something like below but i do not know the right systax.If the path values can be like %programfiles% it can be more better.@echo offset "Folder=X:\Program Files\Regimport"FOR /f "tokens=*" %%A IN ('dir X:\Program Files\Regimport) DO regsvr32 %%Aexit Edited December 10, 2013 by Kullenen_Ask
jaclaz Posted December 10, 2013 Posted December 10, 2013 Which OS/PE?I mean you could use forfiles:http://ss64.com/nt/forfiles.htmlIn more traditional batch, it would be more something like:@echo offset files="X:\Program Files\Regimport\*.reg"FOR /f "tokens=*" %%A IN ('dir /B %files%') DO ECHO regsvr32 %%A(I changed it in such a way that only *.reg files will be listed)But there is something "wrong". Regsvr32 is to register .dll's in the registry, NOT to merge .reg fies! http://ss64.com/nt/regsvr32.htmlmaybe you meant either of :http://ss64.com/nt/reg.htmlhttp://ss64.com/nt/regedit.htmljaclaz
Kullenen_Ask Posted December 10, 2013 Author Posted December 10, 2013 Sorry there will be reg files register only with reg.exe. I wrote wrong. I will put in there forexample "7zip.reg,winrar.reg,winmount.reg...etc". I want them to be seperate because i can frequenty add or remove programs and i want all programs reg additions to be seperate. I will use in winpe. Will try your code if it works.
Yzöwl Posted December 10, 2013 Posted December 10, 2013 I think what you are looking for is:@FOR %%A IN ("X:\Program Files\Regimport\*.reg") DO @REGEDIT /S "%%~A"
Kullenen_Ask Posted December 10, 2013 Author Posted December 10, 2013 Yzöwl your solution looks more short. Can i use it like this or i need to try and learn?@FOR %%A IN ("%ProgramFiles%\RegImport\*.reg") DO @REGEDIT /S "%%~A"
Yzöwl Posted December 10, 2013 Posted December 10, 2013 You can use it like that if your reg files are actually part of the running Operating System otherwise the %PROGRAMFILES% Environment Variable will not be correct.
Kullenen_Ask Posted December 10, 2013 Author Posted December 10, 2013 (edited) Batch file works ok. I am tested. Also with %PROGRAMFILES% Environment Variable@FOR %%A IN ("%ProgramFiles%\RegImport\*.reg") DO @REGEDIT /S "%%~A" Edited December 10, 2013 by Kullenen_Ask
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now