Jump to content

Recommended Posts

Posted

I have a problem with my cleanup script and cannot work out what is wrong. Can somebody have a look because I will go blind if I look for much longer :blink:

This part is working fine:

DEL "%AllUsersProfile%\Start Menu\Windows Update.lnk"
DEL "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk"
DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"

md "%AllUsersProfile%\Start Menu\Programs\Anti Virus & Anti Spyware"
md "%AllUsersProfile%\Start Menu\Programs\CD & DVD"
md "%AllUsersProfile%\Start Menu\Programs\Church"
md "%AllUsersProfile%\Start Menu\Programs\Development"
md "%AllUsersProfile%\Start Menu\Programs\Disk Utilities"
md "%AllUsersProfile%\Start Menu\Programs\Games"
md "%AllUsersProfile%\Start Menu\Programs\Graphics"
md "%AllUsersProfile%\Start Menu\Programs\Health"
md "%AllUsersProfile%\Start Menu\Programs\Internet"
md "%AllUsersProfile%\Start Menu\Programs\Languages"
md "%AllUsersProfile%\Start Menu\Programs\Sound"
md "%AllUsersProfile%\Start Menu\Programs\Viewers & Editors"

move /y "%AllUsersProfile%\Start Menu\Programs\msn.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%AllUsersProfile%\Start Menu\Programs\Windows Messenger.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%AllUsersProfile%\Start Menu\Programs\Windows Movie Maker.lnk" "%AllUsersProfile%\Start Menu\Programs\Accessories\Entertainment\"

The rest of the script fails to work:

move /y "%USERPROFILE%\Start Menu\Programs\Internet Explorer.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%USERPROFILE%\Start Menu\Programs\Outlook Express.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%USERPROFILE%\Start Menu\Programs\Remote Assistance.lnk" "%AllUsersProfile%\Start Menu\Programs\Accessories\System Tools\"
move /y "%USERPROFILE%\Start Menu\Programs\Windows Media Player.lnk" "%AllUsersProfile%\Start Menu\Programs\Accessories\Entertainment\"

I call the above cmd file from RunOnceEx. This works fine for 90% of the file but the other 10% fails. The lines that fail appear to have no effect ... the shortcuts remain under "%USERPROFILE%\Start Menu\Programs\Windows Media Player.lnk".

If I copy the script to the desktop and run it then it seems to work without any problems. As you can see, the offending lines use the %USERPROFILE% environment variable. I just cannot understand why it does not work, surely running this script from runonceex should be the same as running it from the desktop?

Does anybody here know what the problem is ... please?


Posted (edited)

Hmm ... this problem was caused by the shortcuts not being created before I attempted to delete them. I found some other posts and worked out a more efficient way to get around the problem:

Here is my new cleanup.cmd:

DEL "%AllUsersProfile%\Start Menu\Windows Update.lnk"
DEL "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk"
DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"

move /y "%AllUsersProfile%\Start Menu\Programs\msn.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%AllUsersProfile%\Start Menu\Programs\Windows Messenger.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%AllUsersProfile%\Start Menu\Programs\Windows Movie Maker.lnk" "%AllUsersProfile%\Start Menu\Programs\Accessories\Entertainment\"

I have created the following folders on my DVD

$OEM$\$Docs\All Users\Start Menu\Programs\Anti Virus & Anti Spyware"
$OEM$\$Docs\All Users\Start Menu\Programs\CD & DVD"
$OEM$\$Docs\All Users\Start Menu\Programs\Church"
$OEM$\$Docs\All Users\Start Menu\Programs\Development"
$OEM$\$Docs\All Users\Start Menu\Programs\Disk Utilities"
$OEM$\$Docs\All Users\Start Menu\Programs\Graphics"
$OEM$\$Docs\All Users\Start Menu\Programs\Health"
$OEM$\$Docs\All Users\Start Menu\Programs\Internet"
$OEM$\$Docs\All Users\Start Menu\Programs\Languages"
$OEM$\$Docs\All Users\Start Menu\Programs\Sound"
$OEM$\$Docs\All Users\Start Menu\Programs\Viewers & Editors"

And created the following self destructive batch file under $OEM$\$Docs\Default User\Start Menu\Programs\Startup\smenu.cmd

move /y "%USERPROFILE%\Start Menu\Programs\Internet Explorer.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%USERPROFILE%\Start Menu\Programs\Outlook Express.lnk" "%AllUsersProfile%\Start Menu\Programs\Internet\"
move /y "%USERPROFILE%\Start Menu\Programs\Remote Assistance.lnk" "%AllUsersProfile%\Start Menu\Programs\Accessories\System Tools\"
move /y "%USERPROFILE%\Start Menu\Programs\Windows Media Player.lnk" "%AllUsersProfile%\Start Menu\Programs\Accessories\Entertainment\"
del smenu.cmd

This will be copied to each new users profile and ran it should work fine ... I just need to create the ISO and test :whistle:

Edited by Flintstone
Posted

A more effective way would be to

1:\ Run the RunOnceEx then have at the end of that in the RunOnceEx.cmd

have this line

REG ADD %KEY%\100 /VE /D "Adding Cleanup For Next Reboot" /f

REG ADD %KEY%\100 /V 1 /D "%Install%\CleanUp.cmd" /f

Which adds the cleanup.cmd
cmdow @ /HID

@echo off

Set CleanUp=%Systemdrive%\Apps

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

REG ADD %KEY% /V TITLE /D "Clean Up The Install" /f

REG ADD %KEY%\970 /V 1 /D "%CleanUp%\SilentUaC.exe" /f

Then this will run after reooted and it cleans up every thing

Posted (edited)

Hi gunsmokingman

erm ... your second cleanup file also adds runonceex entries but I get the point. When I get back from work I can change my post so it reflects what I have really done. Most of the posts I saw were very vague on how to deal with this issue.

I have chosen to do it your way because then at least the files are together. I can also move the current user registry entries into the second cleanup file and erase the shortcuts from under Default User ... in thoery it should all work better, especially the current user entries because there are often problems with the IE Toolbar changes and disabling the screensaver. I only use 1 user on my PCs but I will set .Default for each reg entry as well so other users will still get most of the changes.

I do not see much point in doing too much more with it, especially because Vista will be out later in the year.

I am planning on having a fully patched Windows and my main apps on one DVD (More if necessary).

Thanks for the advice

Flintstone

Edited by Flintstone

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

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