MSFN Forum: Merge Reg Files Before Windows Starts - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Merge Reg Files Before Windows Starts I think autoexec.bat is the way - not sure Rate Topic: -----

#1 User is offline   HoppaLong 

  • Junior
  • Pip
  • Group: Members
  • Posts: 73
  • Joined: 05-March 05

Posted 17 March 2010 - 05:52 PM

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.softlooku...lay.asp?id=9849 ]]

This post has been edited by HoppaLong: 17 March 2010 - 05:58 PM



#2 User is offline   rloew 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 707
  • Joined: 30-May 05
  • OS:98SE
  • Country: Country Flag

Posted 18 March 2010 - 12:25 AM

Try the following line in your AUTOEXEC.BAT file:

REGEDIT C:\myfile.reg

#3 User is offline   MDGx 

  • 98SE2ME + 98MP10
  • Group: Super Moderator
  • Posts: 2,677
  • Joined: 22-November 04
  • OS:none specified
  • Country: Country Flag

Posted 18 March 2010 - 02:27 AM

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

#4 User is offline   HoppaLong 

  • Junior
  • Pip
  • Group: Members
  • Posts: 73
  • Joined: 05-March 05

Posted 18 March 2010 - 05:52 PM

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.

#5 User is offline   LoneCrusader 

  • Tu ne cede malis, sed contra audentior ito.
  • Group: Supreme Sponsor
  • Posts: 348
  • Joined: 11-May 09
  • OS:98SE
  • Country: Country Flag

Posted 18 March 2010 - 09:42 PM

View PostMDGx, on 18 March 2010 - 02:27 AM, said:

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

:unsure:
I used the CALL command to call WININIT.EXE in my FIX95CPU patch script. It works...

#6 User is offline   dencorso 

  • Adiuvat plus qui nihil obstat
  • Group: Super Moderator
  • Posts: 3,678
  • Joined: 07-April 07
  • OS:98SE
  • Country: Country Flag

Posted 19 March 2010 - 01:26 AM

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.

#7 User is offline   herbalist 

  • paranoid independent
  • PipPipPipPipPip
  • Group: Members
  • Posts: 719
  • Joined: 15-December 06
  • OS:98
  • Country: Country Flag

Posted 19 March 2010 - 08:41 AM

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

#8 User is offline   herbalist 

  • paranoid independent
  • PipPipPipPipPip
  • Group: Members
  • Posts: 719
  • Joined: 15-December 06
  • OS:98
  • Country: Country Flag

Posted 19 March 2010 - 08:50 AM

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.

#9 User is offline   HoppaLong 

  • Junior
  • Pip
  • Group: Members
  • Posts: 73
  • Joined: 05-March 05

Posted 19 March 2010 - 03:29 PM

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

#10 User is offline   dencorso 

  • Adiuvat plus qui nihil obstat
  • Group: Super Moderator
  • Posts: 3,678
  • Joined: 07-April 07
  • OS:98SE
  • Country: Country Flag

Posted 19 March 2010 - 04:07 PM

View Postherbalist, on 19 March 2010 - 08:41 AM, said:

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.

#11 User is offline   herbalist 

  • paranoid independent
  • PipPipPipPipPip
  • Group: Members
  • Posts: 719
  • Joined: 15-December 06
  • OS:98
  • Country: Country Flag

Posted 20 March 2010 - 10:23 AM

View Postdencorso, on 19 March 2010 - 04:07 PM, said:

View Postherbalist, on 19 March 2010 - 08:41 AM, said:

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.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy