Jump to content

batch cleanup question


Recommended Posts

Generally, I use RunOnceEx to install all my applications and this works just fine for me.

However, at the end of ROE, I have had it run a batch command to clean up shortcuts, rearrange my start menu, and things like that. Now it has no problem handling %AllUserProfile%, but when it comes to just vanilla %UserProfile%, it can't do it since the user account hasn't been logged into yet. (I have a user account created via oobe, and that works just fine).

My question is, is it possible to have a batch command run at the end of ROE that enters in a second RunOnceEx command to run at next startup which would take care of the rest of my cleanup, or is there some simpler way to go about it?

Link to comment
Share on other sites


The way i get arround this problem is to have a self deleting .cmd file copied into the Startup folder during install. This way it will only run once the %userprofile% is created. Its not the best way but its the only way i could find that works.

The only issue i have is i want the Startup folder to be hidden and i think this interfears with this.

Link to comment
Share on other sites

The way i get arround this problem is to have a self deleting .cmd file copied into the Startup folder during install. This way it will only run once the %userprofile% is created. Its not the best way but its the only way i could find that works.

The only issue i have is i want the Startup folder to be hidden and i think this interfears with this.

Interesting approach.

I wouldn't mind seeing your code.

Link to comment
Share on other sites

Try this add this to the end of your RunOnceEx.cmd

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\170 /VE /D "Preparing Final Clean Up ..." /f

REG ADD %KEY%\170 /V 1 /D "%systemdrive%\Install\cleanup.cmd" /f

This will run the cleanup.cmd after you have finished installing app and

have rebooted.

Link to comment
Share on other sites

Try this add this to the end of your RunOnceEx.cmd

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\170 /VE /D "Preparing Final Clean Up ..." /f

REG ADD %KEY%\170 /V 1 /D "%systemdrive%\Install\cleanup.cmd" /f

This will run the cleanup.cmd after you have finished installing app and

have rebooted.

Ok, so if I have a small batch at the end of my ROE that is simply a reboot command, I can add this code as is and it will add my cleanup.cmd to ROE?

Sounds good. I'll have to give it a try.

Link to comment
Share on other sites

Or as mentioned use two ROE & reboot between first & second ROE. In the second ROE after all apps are installed call your batch with all the cleanup stuff you need.

I have been doin similar for quite a while & working well.

Cheers

MC.

Edited by MAVERICKS CHOICE
Link to comment
Share on other sites

Try this add this to the end of your RunOnceEx.cmd

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\170 /VE /D "Preparing Final Clean Up ..." /f

REG ADD %KEY%\170 /V 1 /D "%systemdrive%\Install\cleanup.cmd" /f

This will run the cleanup.cmd after you have finished installing app and

have rebooted.

Ok, so if I have a small batch at the end of my ROE that is simply a reboot command, I can add this code as is and it will add my cleanup.cmd to ROE?

Sounds good. I'll have to give it a try.

As long as you have the cmd in this location %systemdrive%\Install\cleanup.cmd then it will run

after the reboot

Link to comment
Share on other sites

As long as you have the cmd in this location %systemdrive%\Install\cleanup.cmd then it will run

after the reboot

Alright, I'm going to try something along those lines...

here's what i've got...

REG ADD %KEY%\086 /VE /D "Rebooting..." /f
REG ADD %KEY%\086 /V 1 /D "%PP%\folder.exe" /f
REG ADD %KEY%\086 /V 2 /D "%PP%\reboot.cmd" /f

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\090 /VE /D "Preparing Final Clean Up ..." /f
REG ADD %KEY%\090 /V 1 /D "%systemdrive%\cleanup.cmd" /f

EXIT

The second line is a simply a little SetupFactory program I made to change the location of My Documents.

I made a simple reboot batch to reboot automatically after 60 seconds. However, I'm concerned that the second ROE won't be entered into the registry until the reboot batch is completed, which wouldn't work, would it?

My reboot.cmd code:

cmdow @ /HID
shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute..."

EXIT

Probably a simpler way to do that, as well.

Link to comment
Share on other sites

As long as you have the cmd in this location %systemdrive%\Install\cleanup.cmd then it will run

after the reboot

Alright, I'm going to try something along those lines...

here's what i've got...

REG ADD %KEY%\086 /VE /D "Rebooting..." /f
REG ADD %KEY%\086 /V 1 /D "%PP%\folder.exe" /f
REG ADD %KEY%\086 /V 2 /D "%PP%\reboot.cmd" /f

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\090 /VE /D "Preparing Final Clean Up ..." /f
REG ADD %KEY%\090 /V 1 /D "%systemdrive%\cleanup.cmd" /f

EXIT

The second line is a simply a little SetupFactory program I made to change the location of My Documents.

I made a simple reboot batch to reboot automatically after 60 seconds. However, I'm concerned that the second ROE won't be entered into the registry until the reboot batch is completed, which wouldn't work, would it?

My reboot.cmd code:

cmdow @ /HID
shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute..."

EXIT

Probably a simpler way to do that, as well.

Should work give it a whirl. I do mine a little differently with three seperate ROE's heres an example.

REG ADD %KEY%\220 /VE /D "Loading Programs Volume Three Please wait" /f

REG ADD %KEY%\220 /V 1 /D "%CDROM%\Software\Runonce\Runonceex2.cmd" /f

REG ADD %KEY%\223 /VE /D "The Machine Will Reboot in Ten Seconds" /f

REG ADD %KEY%\223 /V 1 /D "%CDROM%\Software\Reboot.cmd" /f

Works for me.

Cheers

MC.

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...