Jump to content

Cleanup command


Recommended Posts

Finally got round to using cleanup, but it only partially works.

The offending shortcuts on start, all programs are :

Internet Explorer

Outlook Express

Remote Assistance

Windows Media Player

Windows Movie Maker

These are all in Administrators, I have used AllUsersProfile & UserProfile but they still remain there.

I am testing it using VMWare Workstation.

Here is my cleanup command file

cmdow @ /HID

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

net user aspnet /delete

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

DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"

DEL "%UserProfile%\Start Menu\Programs\Internet Explorer.lnk"

DEL "%UserProfile%\Start Menu\Programs\Outlook Express.lnk"

DEL "%UserProfile%\Start Menu\Programs\Remote Assistance.lnk"

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

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

DEL "%AllUsersProfile%\Desktop\Mozilla Thunderbird.lnk"

DEL "%AllUsersProfile%\Desktop\Mozilla Firefox.lnk"

DEL "%UserProfile%\Desktop\Exact Audio Copy.lnk

RD /S /Q %systemdrive%\Install\

So if anyone can point me in the right direction i would be very gratefull.

I have used search but cannot find exactly what i want.

Thanks in advance

Link to comment
Share on other sites


Finally got round to using cleanup, but it only partially works.

The offending shortcuts on start, all programs are :

Internet Explorer

Outlook Express

Remote Assistance

Windows Media Player

Windows Movie Maker

These are all in Administrators, I have used AllUsersProfile & UserProfile but they still remain there.

I am testing it using VMWare Workstation.

Here is my cleanup command file

cmdow @ /HID

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

net user aspnet /delete

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

DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"

DEL "%UserProfile%\Start Menu\Programs\Internet Explorer.lnk"

DEL "%UserProfile%\Start Menu\Programs\Outlook Express.lnk"

DEL "%UserProfile%\Start Menu\Programs\Remote Assistance.lnk"

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

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

DEL "%AllUsersProfile%\Desktop\Mozilla Thunderbird.lnk"

DEL "%AllUsersProfile%\Desktop\Mozilla Firefox.lnk"

DEL "%UserProfile%\Desktop\Exact Audio Copy.lnk

RD /S /Q %systemdrive%\Install\

So if anyone can point me in the right direction i would be very gratefull.

I have used search but cannot find exactly what i want.

Thanks in advance

I am not the best at Cmd Promt scripts so I wrote your as a VBS script.

I have not tested this script, but it should do what you need.

Save As CleanUp.vbs

'/-> Const Are Like Varibles But Are Permanent
Const ALL_USERS_START_MENU = &H16&
Const START_MENU = &Hb&
Const PROGRAMS = &H2&
'/-> Objects For The Script
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Shell :Set Shell = CreateObject("Shell.Application")
Dim Tmp :Tmp = Act.ExpandEnvironmentStrings("%Temp%\CleanUP.vbs")
'/-> Varibles
Dim F1, F2, F3, Folder, FolderItem
'/-> Shut Down Notice
Act.Run("shutdown.exe -r -f -t 60 -c " &_
Chr(34) & "Windows XP will now restart in 1 minute..." & Chr(34)),1,False
'-> Remove User
Act.Run("%Comspec% /c net user aspnet /delete"),0,True
'/-> All User Start Menu
Set Folder = Shell.Namespace(ALL_USERS_START_MENU)
Set FolderItem = Folder.Self
Set F1 = Fso.GetFolder(FolderItem.Path)
For Each F2 In F1.Files
If InStr(F2.Path, "Set Program Access and Defaults.lnk") Or _
InStr(F2.Path, "Windows Catalog.lnk") Then
Fso.DeleteFile(F2.Path),True
End If
Next
'/-> User Start Menu Programs
Set Folder = Shell.Namespace(PROGRAMS)
Set FolderItem = Folder.Self
Set F1 = Fso.GetFolder(FolderItem.Path)
For Each F2 In F1.Files
If _
InStr(F2.Path,"Internet Explorer.lnk") Or _
InStr(F2.Path,"Outlook Express.lnk") Or _
InStr(F2.Path,"Remote Assistance.lnk") Or _
InStr(F2.Path,"Windows Media Player.lnk") Or _
InStr(F2.Path,"Windows Movie Maker.lnk") Then
Fso.DeleteFile(F2.Path),True
End If
Next
'/-> Delete The VBS File In The Temp Folder
If Fso.FileExists(Tmp) Then Fso.DeleteFile(Tmp) End If

Edited by gunsmokingman
Link to comment
Share on other sites

Here is an untested method, I've just come up with. It is a compiled batch file which deletes according to a file list containing the names of each of your shortcuts.

The attachment contains the compiled batch file, nolinx.exe and a file list, nolinx.dat, (according to your post).

All you need to do is keep the two of them in the same location and invoke the executable. The file can be run as is in the GUI but should work silently without creating any windows too!

For anyone else wanting to give it a try, you just need to create or edit the dat file which cannot be renamed. The file is intended to be used for Win2k and XP, it may work on other OS's but as I say it is untested.

nolinx.zip

Link to comment
Share on other sites

A big thanks to both of you for your time and efforts,

They both work great when called manually, but not when i run them from my runonce file.

Maybe i need to run then differently somehow.

Anyway thanks again :)

Link to comment
Share on other sites

They both work great when called manually, but not when i run them from my runonce file.
How are you doing that then?

There should be no reason I can think of, short of an error on your part, why either method shouldn't work from Runonce!

Link to comment
Share on other sites

They both execute from runonce, but nothing gets deleted ,( one does reboot) but if i go into the install folder which was transferred over and run them they both work.

So i don't really know whats going on, has it got anything to do with testing in vmware?

Link to comment
Share on other sites

My program will delete them if they exist, and since you have proven them to work you only have two possible reasons.

  1. Your Runonce command or its execution is not working.
  2. The shortcuts you are trying to delete have not yet been created.

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