Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Automated importing of multiple .reg-files

- - - - -

  • Please log in to reply
5 replies to this topic

#1
Jer0en

Jer0en
  • Member
  • 2 posts
  • Joined 18-September 04
Hi,

i've been working on my own unattended bootable installation-cd... and i was wondering if there was an easier way to import multiple .reg-files without having to specify each and every filename.

So i wrote this lil' batch, it tries to solve specified arguments to obtain a valid searchpath to be passed on to the search- & import-routine. You can specify root-directories (i.e. directories with a trailing backslash, like: C:\ or D:\Temp\), regular directories (i.e. directories without a trailing backslash, like: C:\Windows) and you can also specify a specific fully qualified filename/searchpath. - This batch can handle an unlimited amount of commandline parameters [unless there's a limiting factor within Windows i'm not aware of]. - Instead of regedit.exe i'm using a fairly unknown lil' program which doesn't mind any registry-editing restrictions: reg.exe -- and best of all: it's part of the Windows operating system, every Windows 2000 and XP has it. - It supports cmdow.exe, and most of it's commandline arguments. There are two restrictions however: 1) multi-parameter functions like /REN and /MOV and window/process-listings are not supported, and 2) supported functions are restricted to @ i.e. the window in which the batch is running.

I hope you'll enjoy it as much as i do :) If you find a way to improve on it, please send me a copy... e.g. i failed to filter-out directories and driveletters. (But then again, this shouldn't be much of a problem when good paths are provided.)

"type" cannot open a directory or a driveletter, however it does support wildcards... the ideal solution to filter-out these non-registry files... but it didn't work for me :(
type "%TMP_SEARCH_PATH%" > NUL
if NOT ERRORLEVEL 0 goto NEXT
"cd" cannot change directory to a filename, too bad i don't have a way to store the current working path -- because i don't want to lose it! (...i might need it later on.)
cd "%TMP_SEARCH_PATH%" > NUL
if ERRORLEVEL 0 goto NEXT
there's an alternative to the "cd"-solution which does allow me to check and keep my own working path, but it's an ugly solution because an error message doesn't get redirected to NUL:
%ComSpec% /c cd "%TMP_SEARCH_PATH%" > NUL
if ERRORLEVEL 0 goto NEXT
and the final alternative to the "cd"-solution didn't appear to work either:
start /MIN %ComSpec% /c cd "%TMP_SEARCH_PATH%" > NUL
if ERRORLEVEL 0 goto NEXT
P.S. i included a lil' program i wrote in 2002 which has about the same functionality as the ImportReg batch... the differences are: it's an executable (written in Delphi, source-code included) and it processes fonts and Active-X.

Well, try and enjoy my contributions! I'm off reïnstalling Windows now :)

Attached Files




How to remove advertisement from MSFN

#2
edg21

edg21

    Member

  • Member
  • PipPip
  • 196 posts
  • Joined 29-August 03
I just us this to import multiple .reg files :)

for %%i in (%TWK_DIR%\*.reg) do REGEDIT /S %%i

"Hey baby, wanna kill all humans?"
HowTo: Unattended Install Using FTP

#3
Dahi

Dahi

    Member

  • Member
  • PipPip
  • 146 posts
  • Joined 25-November 03
Instead of CD, use PUSHD to change to a directory, then POPD to return to your working folder.

PUSHD C:\Windows
...
POPD


#4
edg21

edg21

    Member

  • Member
  • PipPip
  • 196 posts
  • Joined 29-August 03

Instead of CD, use PUSHD to change to a directory, then POPD to return to your working folder.

PUSHD C:\Windows
...
POPD

Good advice :)
"Hey baby, wanna kill all humans?"
HowTo: Unattended Install Using FTP

#5
sleepnmojo

sleepnmojo

    Advanced Member

  • Member
  • PipPipPip
  • 472 posts
  • Joined 02-March 04
This is the one I use, it does both inf and reg files, and recurses down the directory. I have the same install.cmd in each directory. I could probably make it better, but it does the trick.

@ECHO OFF
CMDOW @ /HID
TITLE Installing Reg Tweaks

SETLOCAL & PUSHD %~dp0
    FOR /D %%d IN (*) DO CMD.EXE /C %%d\install.cmd
    FOR %%I IN (*.REG) DO REGEDIT /s "%%I"
    FOR %%I IN (*.INF) DO RUNDLL32.EXE setupapi,InstallHinfSection DefaultInstall 128 %%~fnxI
POPD & ENDLOCAL
GOTO :EOF


#6
Jer0en

Jer0en
  • Member
  • 2 posts
  • Joined 18-September 04
These are some cool tips, thanks guys :)

btw, a few days ago i discovered there is a environment variable called "%CD%" which holds the current directory...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users