Jump to content

Recommended Posts

Posted (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 by Kullenen_Ask

Posted

Which OS/PE?

I mean you could use forfiles:

http://ss64.com/nt/forfiles.html

In more traditional batch, it would be more something like:

@echo off
set 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". :ph34r:

Regsvr32 is to register .dll's in the registry, NOT to merge .reg fies! :w00t:

http://ss64.com/nt/regsvr32.html

maybe you meant either of :

http://ss64.com/nt/reg.html

http://ss64.com/nt/regedit.html

jaclaz

Posted

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.

Posted

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"
Posted

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.

Posted (edited)

Batch file works ok. I am tested. Also with %PROGRAMFILES% Environment Variable

@FOR %%A IN ("%ProgramFiles%\RegImport\*.reg") DO @REGEDIT /S "%%~A"
Edited by Kullenen_Ask

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...