Jump to content

Problems with getting RunOnce to work


Alien42

Recommended Posts

Although I may want to do more later, at the moment all I want to be able to do with the RunOnce feature is create some empty folders with specific names, merge in some .reg files, & run a couple of installers, but so far the only thing I can get to work is the empty folder creation.

The empty folder creation is done from a batch file with the command line:

%source%\batch\makefolders.bat

No problems there, but everything else I've tried to get the rest working fails.

I've tried both:

regedit /s "%source%\regfiles\filename.reg"

"regedit /s %source%\regfiles\filename.reg"

as indivual lines in the RunOnce tab in nLite, as well as putting them in a batch file. I've also tried using %%source%%, as apprently batch files need a double % instead of a single 1.

I tried using an xcopy command to copy the regfiles folder to the drive & then run them from there, which didn't work either [wouldn't even do the xcopy]. I've even tried using the OEM folder method to copy the files over, which worked, & then merge the reg files from there, which didn't work.

Anyone got any ideas?

Link to comment
Share on other sites


Alien42,

I know this is not a direct answer to your question but I suggest you look into WPI (Windows Post Install). It will do all the things you want and is much easier to use. See a couple forums below the nLite forum.

Enjoy, John.

Link to comment
Share on other sites

Well, I just tried the svcpack.inf method, & even that didn't work! WTF?!

I put the reg files in the svcpack folder, then added the necessary lines to svcpack.inf, e.g:

regedit.exe /s "Notepad.reg"

regedit.exe /s "UpdatesDisableNotify.reg"

regedit.exe /s "AntiVirusDisableNotify.reg"

regedit.exe /s "Single Click Underline Icons.reg"

& still no luck. :realmad:

Link to comment
Share on other sites

Although I may want to do more later, at the moment all I want to be able to do with the RunOnce feature is create some empty folders with specific names, merge in some .reg files, & run a couple of installers, but so far the only thing I can get to work is the empty folder creation.

The empty folder creation is done from a batch file with the command line:

%source%\batch\makefolders.bat

No problems there, but everything else I've tried to get the rest working fails.

I've tried both:

regedit /s "%source%\regfiles\filename.reg"

"regedit /s %source%\regfiles\filename.reg"

as indivual lines in the RunOnce tab in nLite, as well as putting them in a batch file. I've also tried using %%source%%, as apprently batch files need a double % instead of a single 1.

I tried using an xcopy command to copy the regfiles folder to the drive & then run them from there, which didn't work either [wouldn't even do the xcopy]. I've even tried using the OEM folder method to copy the files over, which worked, & then merge the reg files from there, which didn't work.

Anyone got any ideas?

The "\" after %source% is not needed, in fact %source% already contain one

Link to comment
Share on other sites

The "\" after %source% is not needed, in fact %source% already contain one

It shouldn't make any difference, Windows just ignores any extra back-slashes in the path. I tested that theory both in a command prompt window & a batch file. Even 3 slashes will work as if there were just 1. Besides, if that were the cause then the batch file for creating the empty folders wouldn't work, but it does work

Link to comment
Share on other sites

I've been having the same problem. Used a batch file to replace some files and then import some regs.

This batch file works flawless if I manually run it after windows has fully booted.

But during RunOnce, the batch file runs with nothing but errors.

I'm using the v4 format (first line REGEDIT4) for my reg files, but name them as text files for easier editing.

With lines in batch file like: REG IMPORT rSwapOnD300.txt

I also tried running from CD and from HDD with same result.

Link to comment
Share on other sites

I've been having the same problem. Used a batch file to replace some files and then import some regs.

This batch file works flawless if I manually run it after windows has fully booted.

But during RunOnce, the batch file runs with nothing but errors.

I'm using the v4 format (first line REGEDIT4) for my reg files, but name them as text files for easier editing.

With lines in batch file like: REG IMPORT rSwapOnD300.txt

I also tried running from CD and from HDD with same result.

I've made some progress with this. As I said before, I have a batch file which creates some empty folders, which is set up from nLite's RunOnce section, with the command:

%source%\batch\makefolders.bat

As this was the only thing that worked, I decided to try adding some of the extra stuff I wanted done to the end of that file, & it worked! :D

For my reg tweaks, I copy them over by putting them in a folder like

S:\XP_Source\$OEM$\$1\Regfiles

and then add a line like

start /w regedit /s "%SystemDrive%\Regfiles\mytweaks.reg"

to my batch file.

I'm not sure, but I think the reason the %source% variable works for running the first batch file, & not for anything inside that batch file, is because of the way Nuhi's implemented the whole RunOnce & %source% thing. I haven't gotten around to trying it yet [can't be bothered :D], but I think if you added a line into your batch file that sets a variable to store the CD drive letter, as Nuhi does in the .cmd file he creates, & use that, then it should work. I said I haven't tested it with the regfiles, but it works fine for other things. [the drive letter finding command I found is a little different to Nuhi's, but it still gets the job done]

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\WIN51AP.SP2 SET CDROM=%%i:

To make it work you just have to get it to look for a specific file in the root of the CD drive. In my case I've told it to look for WIN51AP.SP2, but if you're using a different version of XP, or don't have that file for whatever reason, you can just create an empty file like "cdrom.txt" or whatever & have the command look for that instead.

I've tested it with stuff like VirtualBox's VBoxAdditions, Windows Update Agent, & .Net 2.0 SP1 x64 [a 7-zip silent installer version I made].

[side note: for some reason I've found that none of the three progs I mentioned above will work if I put start /w before them. I think this has got something to do with the variable only being valid per instance of command line or whatever, so a possible work around might be to use start /w somebatchfile.bat to call another batch file, & then make sure to add the drive letter setting command into that batch file before the line that calls the specific prog. Again, this is an untested theory. ;)]

Just for good measure I have put the drive-finding command before each of those, as I got so frustrated with things not working that I couldn't be bothered with any more "trial & error" if I could avoid it, but it might work with just 1 instance of that command per batch file; I just can't be bothered to put that to the test at the moment.

<edit>

P.S.: I don't know if it makes any difference, but XP .reg files usually say version 5, not 4.

</edit>

Edited by Alien42
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...