Jump to content

Install directory is not deleted by cleanup.cmd


Recommended Posts

Here is a copy of my cleanup.cmd

cmdow @ /HID

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

net user aspnet /delete

RD /S /Q "%AllUsersProfile%\Start Menu\Programs\Java Web Start"

DEL "%UserProfile%\Start Menu\Programs\Windows Media Player.lnk"

DEL "%AllUsersProfile%\Start Menu\Programs\Windows Movie Maker.lnk"

DEL "%AllUsersProfile%\Desktop\Java Web Start.lnk"

DEL "%AllUsersProfile%\Start Menu\Programs\LaunchRA.lnk"

DEL "%systemdrive%\Install\"

RD /S /Q %systemdrive%\Install\

RD /S /Q %systemdrive%\drivers\

EXIT

Everything else seems to be working as advertised. But after all is said and done "C:\Install" is still there. Any ideals as to what I'm doing wrong?

Thanks

Link to comment
Share on other sites


If you do have Admin rights which was one of my problem's but no longer. Move this line down to right above EXIT.

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

EXIT

I also use this format since its correct syntax. rd [Drive:]Path [/q]

Work's for me.

RD %systemdrive%\drivers\ /S /Q

Link to comment
Share on other sites

One of these ought to work. Remember to put the Drivers directory above the Install directory or the Drivers directory won't get deleted.

RD /S /Q "%systemdrive%\Drivers"
RD /S /Q "%systemdrive%\Install"
RMDIR /S /Q %systemdrive%\Drivers\
RMDIR /S /Q %systemdrive%\Install\

Link to comment
Share on other sites

Hi!

this also can be a timing issue, i had this when testing on a VMWare Enviourement, increasing the reboot time form 60 to 90 seconds solved this issue for me once and for all, so might also be worth a try!

Greetz

KMan

Link to comment
Share on other sites

I've always used this code and it's always worked for me. I have the code run last, and anything that takes a long time to install such as nero i put at the top of the list.

HKLM,"%RunOnceEx%\ZZcleanup",2,,"%11%\cmd.exe /c rd /S /Q %10%\Apps"

-gosh

Link to comment
Share on other sites

maxXPsoft,

If you do have Admin rights which was one of my problem's but no longer. Move this line down to right above EXIT.

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

EXIT

When I tried this, it just hung there. Never rebooted

KMan,

I increased time to 2 mins and no help

HKLM,"%RunOnceEx%\ZZcleanup",2,,"%11%\cmd.exe /c rd /S /Q %10%\Apps"

Sorry Gosh,

I'm completely lost on how to apply this code. And what is ZZcleanup?

Please pardon my ignorance,

Thanks

Link to comment
Share on other sites

When I tried this, it just hung there. Never rebooted
That narrows it down. Ok then if it hangs something else is wrong above that.

Heres mine

cmdow @ /HID

net user aspnet /delete

RD "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\PrintMe Internet Printing" /S /Q

RD "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Java Web Start" /S /Q

DEL "%AllUsersProfile%\Desktop\Adobe Reader 6.0.lnk"

DEL "%AllUsersProfile%\Desktop\Java Web Start.lnk"

REM Cleanup Winzip if you have it. Remove if you don't

DEL "%AllUsersProfile%\start menu\WinZip.lnk"

DEL "%AllUsersProfile%\desktop\WinZip.lnk"

DEL "%AllUsersProfile%\start menu\Programs\WinZip\Uninstall WinZip.lnk"

DEL "%AllUsersProfile%\start menu\Programs\WinZip\Help Manual.lnk"

DEL "%AllUsersProfile%\start menu\Programs\WinZip\ReadMe.txt.lnk"

DEL "%AllUsersProfile%\start menu\Programs\WinZip\What's New.lnk"

REM Unhide protected Operating System Files

REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /V ShowSuperHidden /t REG_DWORD /D "1" /f

RD %systemdrive%\drivers\ /S /Q

RD %systemdrive%\install\ /S /Q

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

EXIT

And it work's, like I said I had problem's with it hanging cause my user wasn't getting Admin and I corrected that.

Link to comment
Share on other sites

Just noticed also that yours has this

DEL "%systemdrive%\Install\"

RD /S /Q %systemdrive%\Install\

Remove the DEL "%systemdrive%\Install\" cause you getting that with next line with the RD which removes entire dir and thats probably where its hanging.

Link to comment
Share on other sites

:) maxXPsoft,

Thanks to you I have made some progress. This is what I have so far.

cmdow @ /HID

net user aspnet /delete

RD /S /Q "%AllUsersProfile%\Start Menu\Programs\Java Web Start"

DEL "%UserProfile%\Start Menu\Programs\Windows Media Player.lnk"

DEL "%AllUsersProfile%\Start Menu\Programs\Windows Movie Maker.lnk"

DEL "%AllUsersProfile%\Desktop\Java Web Start.lnk"

DEL "%AllUsersProfile%\Start Menu\Programs\LaunchRA.lnk"

RD /S /Q %systemdrive%\Drivers\

RD /S /Q %systemdrive%\Install\

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

EXIT

This would delete everything in C:\Install but not the directory itself and shut.exe would not run.

I then put shutdown.exe in the third line and it executes just fine and deletes everything in C:\Install.

I know there is more than one way to skin a cat.

Thanks for your help

Link to comment
Share on other sites

Because you have RD /S /Q %systemdrive%\Install\ before the shutdown command, it deletes the install directory, thus killing the batch file thats in there. Its more wise to have the RD command last, and place shutdown somewhere above it.

Link to comment
Share on other sites

Disoriented One

Then it was that

DEL "%systemdrive%\Install\"

RD /S /Q %systemdrive%\Install\

Aaron

What I posted works for me cause I'm thinking when you run the batch it's loaded into memory or in process. My Install get's deleted but is it because of processor, memory or what? Maybe fast processor is running next line . I don't know.

With the shutdown.exe -r -f -t 60 you have 60 seconds to carry out everything so that's plenty of time so moving it above certainly wouldn't hurt.

Good ? or no.

I may move mine above but i'm gonna test this a little, maybe write a bogus script that takes time then delete it and see what give's.

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