Jump to content

Merge Reg Files Before Windows Starts


HoppaLong

Recommended Posts

I haven't had to add lines to autoexec.bat for several years.

I want to import or merge a couple of registry files before Windows

starts. This must happen each time the system boots, not just once.

Right now, my autoexec.bat file is empty.

I tried this:

CALL C:\myfile.reg

The result was an "invalid switch" error.

Someone mentioned on another forum that all you need is

the pathname to the reg file, nothing else.

Rather than messing around with autoexec.bat, I would be

happier if I could find a little applet that could do the job.

I've searched, but I can't find anything.

If it can be done easily using autoexec.bat, please, show me

the way!

One thing I do remember about these "run > sysedit" files

is how strange they can be. Command lines that work on

one system may fail on another. That's why I was hoping

to find a simple command line app.

[[ You might remember the command line tool RegDel. I used

it hundreds of times to delete keys and values. It never failed.

Its still available here:

http://www.softlookup.com/display.asp?id=9849 ]]

Edited by HoppaLong
Link to comment
Share on other sites


For 100% unattended ["hands free"] operation [no prompts, no pause], use the /S switch in autoexec.bat or batch file (example):

REGEDIT /S C:\MYREG.REG

Must specify full path to REG file [unless found in the PATH statement] and reg file extension.

FYI:

The CALL command works only with batch files [*.BAT].

HTH

Link to comment
Share on other sites

I've created countless shortcuts and typed a zillion

"run" commands with that REGEDIT /S. It always works

perfectly from within the Windows environment.

I'm 99% certain I added the line "REGEDIT /S C:\MYREG.REG"

to autoexec.bat. It returned an error message.

I also created a batch file:

@ECHO OFF

REGEDIT /S C:\MYREG1.REG

REGEDIT /S C:\MYREG2.REG

I reviewed a couple of my old books about DOS.

You're right about CALL, MDGx.

I tried again:

CALL C:\MYFILE.BAT

An "Invalid Switch" error was returned.

Years ago, I can't believe how patient I was with DOS.

What choice did we have? There was no GUI. Thank goodness,

many of the newer scripting languages are more reliable and

powerful.

One of my DOS books goes into great detail about adding

lines to config.sys and autoexec.bat. The author mentions

that 99% of the time a new line should be added at the

bottom of the file.

He says to press Ctrl+End and then hit the Enter key.

Since my autoexec.bat file is empty, there is no end or

beginning. Just to make sure the system recognized

the file as empty, I used "select all > delete > save."

The cursor does not move with the arrow keys, so the

file is definitely empty!

If the command lines shown above are correct, why is

DOS returning error messages?

Here is a quote I saved from another forum:

"I know other batch files can be run through a batch

file by using the "call" command, but this doesn't

work for registry files."

I apologize guys. DOS always made me feel stupid!

The "call" command must work for a batch file, but

it's not working as the first line in my autoexec.bat

file.

REGEDIT /S [PATHNAME] added to my empty autoexec.bat

file doesn't work either.

You don't have to tell me that it must work. For some

reason, DOS is kicking me in the a**, like it has so

many times in the past.

Link to comment
Share on other sites

Of course it does work with .EXEs and .COMs...

I think MDGx meant to say "CALL only works from within batch files". And, in a sense, this is true...

If you invoke a batch file directly from within a batch file, the second batch fails to return to the first one, as it ends, causing both to terminate, while if you invoke the second batch file by means of the CALL command, then the second batch, after it ends, returns to the first one, which resumes processing normally. This is the reason for which the CALL command was created, in the first place.

On the other hand, invoking .EXEs and .COMs with CALL or without it have the exact same result.

Link to comment
Share on other sites

The "/s" switch for regedit is invalid in autoexec.bat. You should be able to launch regedit directly from autoexec.bat.

Try it using this syntax:

REGEDIT C:\folder\MYREG1.REG

REGEDIT C:\folder\MYREG2.REG

It would also be better if you have the .reg files in a folder instead of your root directory. I seem to remember that there's some limitation regarding the number of file entries in the root directory.

Link to comment
Share on other sites

OK herbalist.

As I quickly discovered, adding the /S switch to autoexec.bat

brings up an "invalid switch" error.

Here's another "believe it or not" sort of thing. I do

have my reg file in a root folder, like you show in your

reply:

REGEDIT C:\folder\MYREG1.REG

However, if I include "C:\" in the command I get an error

message! If I leave it out, the files are imported normally.

The folder name is MERGREG, so it shouldn't cause any

problems. There are no spaces and it stays within the

eight letter naming convention.

I don't expect a logical explanation, but why do the commands

work only when the "C:\" is not included:

Like this:

REGEDIT MERGREG\MYFILE.REG

Link to comment
Share on other sites

You need to exit the command prompt interpreter for the called batch file. Add this to the end of the called batch file:

command /c exit

I respectfully disagree.

More info here: CALL.

On my present 98SE unit, adding "command /c exit" to the called batch file did prevent the system from booting. On my 98FE unit, I call a batch file from autoexec.bat that's very similar to the one in my signature. That batch file ends with "command /c exit" and the system will not finish booting if I remove it. I can't explain this discrepancy unless FE and SE behave that much differently, or something else I did on that system is changing that behavior. Right now, the monitor for my FE unit failed so I can't compare them. I did make a VPC copy of that FE system, allowing it to change drivers as necessary, hoping to test this on it. Batch files don't run properly on VPC.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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