Kullenen_Ask Posted December 10, 2013 Share 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 Link to comment Share on other sites More sharing options...
jaclaz Posted December 10, 2013 Share 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 Link to comment Share on other sites More sharing options...
Kullenen_Ask Posted December 10, 2013 Author Share 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. Link to comment Share on other sites More sharing options...
Yzöwl Posted December 10, 2013 Share Posted December 10, 2013 I think what you are looking for is:@FOR %%A IN ("X:\Program Files\Regimport\*.reg") DO @REGEDIT /S "%%~A" Link to comment Share on other sites More sharing options...
Kullenen_Ask Posted December 10, 2013 Author Share 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" Link to comment Share on other sites More sharing options...
Yzöwl Posted December 10, 2013 Share 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. Link to comment Share on other sites More sharing options...
Kullenen_Ask Posted December 10, 2013 Author Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now