Jump to content

Clean up Cmd Template


 Share

Recommended Posts

Here is a Clean Up Cmd Template For A Ua

This script removes every thing and it self

Stuff In Red Is Safe To Remove From Script

Stuff In Green Is What You Need To Change

To Match Your Needs

Stuff In Blue Can Be Changed Or Deleted

Stuff In Purple Use Care In Modifing

I Gunsmokingman give all users full permission to do what ever they want with this script.

echo off

cls

color f2

mode con: Cols=45 Lines=3

:: THIS IS A TEMPLATE TO MAKE SURE THERE NO FILES LEFT OVER

:: FROM A UNATTENDED INSTALL

:::HERE WHERE I AM SETTING SOME DIR VARIBLES

Title R1-CleanUp.cmd

set SD=%Systemdrive%\Install\

set SD1=%Systemdrive%\Install\1T\

set SD2=%Systemdrive%\Install\2T\

echo.

:::HERE WHERE I AM SETTING SOME DIR VARIBLES

:: Build A Test Area To test This

mkdir %SD1%

mkdir %SD2%

:: Build A Test Area To test This

TO STOP THE SCRIPT

:: 1000 = 1 SECOND

> %SD%R1.vbs echo wscript.sleep 875

>> %SD%R1.vbs echo wscript.quit

> %SD%R2.vbs echo wscript.sleep 1925

>> %SD%R2.vbs echo wscript.quit

> %SD%R3.vbs echo wscript.sleep 2925

>> %SD%R3.vbs echo wscript.quit

:Part1

cls

color B0

:: REPLACE HERE WITH WHAT EVER IS NEEDED THESE WHERE HERE FOR THE TEST

> %SD1%PART1.vbs echo MSGBOX "HERE IS THE" ^& vbcrlf ^& "FIRST ONE STARTS",VBOKONLY+48,"TESTING 1"

Title RUNNING FROM TEST ONE DIR

start /w wscript.exe %SD%R1.vbs

start /w wscript.exe %SD1%PART1.vbs

del %SD1%PART1.vbs

echo.

echo PART1 Completed?

RmDir %SD1%

start /w wscript.exe %SD%R2.vbs

:Part2

:: REPLACE HERE WITH WHAT EVER IS NEEDED THESE WHERE HERE FOR THE TEST

> %SD2%PART2.vbs echo MSGBOX "HERE IS THE" ^& vbcrlf ^& "SECOND ONE STARTS",VBOKONLY+48,"TESTING 2"

cls

color 7f

:::HERE IS THE SECOND PART OF THE ACTION

Title RUNNING FROM TEST TWO DIR

start /w wscript.exe %SD%R1.vbs

start /wait %SD2%PART2.vbs

del %SD2%PART2.vbs

echo.

echo PART2 Completed?

RmDir /s /q %SD2%

start /w wscript.exe %SD%R2.vbs

:: TEXT AFTER :: THESE ARE SAFE TO DELETE

::HERE THE FINAL CLEAN UP VBS

::TO DELETE MORE FOLDERS ADD THESES

::Garbage.DeleteFolder ("%Systemdrive%\Install") ADD YOUR OWN PATH TO FOLDER

::Delete=("%Systemdrive%\Install\")

::TO DELETE MORE FILES ADD THIS

::Garbage.DeleteFile ("\msg1.vbs") ADD YOUR OWN PATH TO FILE

::\ THAT MEANS THE DIR IT START FROM THIS START FROM SYSTEMROOT

::KEEP THIS PART IT REMOVES EVERY THING EVEN IT SELF

:CLEANUP

cls

COLOR F3

TITLE FINAL CLEAN UP

> %Systemdrive%\msg1.vbs echo Dim Garbage

>> %Systemdrive%\msg1.vbs echo set Garbage = (CreateObject("Scripting.FileSystemObject"))

>> %Systemdrive%\msg1.vbs echo msgbox "Starting Clean UP?",vbokonly+48,"Clean Up"

>> %Systemdrive%\msg1.vbs echo wscript.sleep 500

>> %Systemdrive%\msg1.vbs echo Garbage.DeleteFolder ("%Systemdrive%\Install")

>> %Systemdrive%\msg1.vbs echo Delete=("%Systemdrive%\Install\")

>> %Systemdrive%\msg1.vbs echo Garbage.DeleteFile ("\msg1.vbs")

>> %Systemdrive%\msg1.vbs echo wscript.sleep 500

>> %Systemdrive%\msg1.vbs echo Delete=("\msg1.vbs")

>> %Systemdrive%\msg1.vbs echo wscript.sleep 500

start /w %Systemdrive%\msg1.vbs

ECHO.

ping -n 2 127.0.0.1>nul | set/p = Processing Final Clean Up!

exit

R1_CleanUp.cmd

Link to comment
Share on other sites

  • 5 weeks later...

Completed

YES OR TIME OUT ACTION

1\ Java Web Start.lnk2\ Nero StartSmart.lnk3\ Mozilla.lnk4\ Set Program Access and Defaults.lnk5\ Windows Catalog.lnk    FOLDERS1 \ Drivers Folder2\ Install Folder
NO Button Actions

1:\ My MakecaB Utility, All You Do Is Type In The DirectoryAnd It Makes A Folder Called WHATEVER-YOU-TYPE-IN\ARCHIVEThen It Runs The MakeCab cmd Move The Files There Outputs A ExpandCmd To Where The Files Are Located. Deletes The Source Files.2:\ A way to delete 2 folder if they are not named Install OrDrivers that you may delete as part of the UA This Includes Shortcuts3\ A 3 Preselected Radio Stations4:\ Just A Delete Folder Program That WillDelete As Many Folders As You Want Until You
Cancel

Will Just Close The Script And Just Clean Up The  Files Generated.
To Edit I Will Add A link To The Code Later

I Gunsmokingman give all users full permission to do what ever they want with this script.

GmanUtilities.exe

Link to comment
Share on other sites

  • 3 weeks later...

This Is To Clean Up The Ua Silent No Box Or Messages

It Removes

SHORTCUTS Removed If Present

1\ Java Web Start.lnk

2\ Nero StartSmart.lnk

3\ Mozilla.lnk

4\ Set Program Access and Defaults.lnk

5\ Windows Catalog.lnk

6\ $winnt$.inf

FOLDERS

1\ Drivers Folder

2\ Install Folder

1\ To Edit Use Winrar And Extract The GmanSilentCUP.VBS

2\ Than While Using Winrar Rename The GmanSilentCUP.VBS In The WinRar SFx To GmanSilentCUP-1.VBS Or What Ever You Want

3\ Edit The GmanSilentCUP.VBS To What You Need.

4\ Add Your Edit GmanSilentCUP.VBS Back To The SilentUaC.exe Using WinRar

5\ Delete The GmanSilentCUP-1.VBS Or What Ever You Named It

6\ Completed!

Purple Are Varibles And Pathway To Specific Places

On Your Hard Drive.

Green Are The Folders Or Files That Get Deleted

Orange Are The Action These Are For Either A Folder Or File

Red Do Not Delete Or Remove Unless You Know What You Are Doing

New Code Must Be Change Manually The Down Load Is The Original Code

This One Uses A Array And The Code Is One Line Smaller Now.

To Change What Gets Delete Change What In Garbage

EG = Array (Needs, To, Have, A, Comma, Unless, It, The, End)

ON ERROR RESUME NEXT

Dim Act, AP, Fso, Garbage, UP, SD, SP, Wd

Set Act = WScript.CreateObject("WScript.Shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

AP = Act.ExpandEnvironmentStrings("%AllUsersProfile%")

UP = Act.ExpandEnvironmentStrings("%UserProfile%")

SD = Act.ExpandEnvironmentStrings("%SystemDrive%")

SP = Act.ExpandEnvironmentStrings("%SystemDrive%\Program Files")

Wd = Act.ExpandEnvironmentStrings("%Windir%")

Garbage = Array((AP & "\Desktop\ Java Web Start.lnk"),(AP & "\Desktop\ Nero StartSmart.lnk"),(AP & "\Desktop\ Mozilla.lnk"),_

(AP & "\Start Menu\ Set Program Access and Defaults.lnk"),(AP & "\Start Menu\Windows Catalog.lnk"),(Wd & "\System32\$winnt$.inf"),_

(SD & "\GmanSilentCUP.VBS"),(SD & "\Drivers"),(SD & "\Install"))

For Each DelF In Garbage

Fso.DeleteFolder(DelF)

Fso.DeleteFile(DelF)

Next

On Error Resume Next

Dim Act, AP, Fso, UP, SD, SP, Wd, Garbage

Set Act = CreateObject("WScript.Shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

AP = Act.ExpandEnvironmentStrings("%AllUsersProfile%")

UP = Act.ExpandEnvironmentStrings("%UserProfile%")

SD = Act.ExpandEnvironmentStrings("%SystemDrive%")

SP = Act.ExpandEnvironmentStrings("%SystemDrive%\Program Files")

WD = Act.ExpandEnvironmentStrings("%Windir%")

Fso.DeleteFolder(SD & "\Install")

Fso.DeleteFolder(SD & "\Drivers")

Fso.DeleteFile(AP & "\Desktop\Java Web Start.lnk")

Fso.DeleteFile(AP & "\Desktop\Nero StartSmart.lnk")

Fso.DeleteFile(AP & "\Desktop\Mozilla.lnk")

Fso.DeleteFile(AP & "\Start Menu\Set Program Access and Defaults.lnk")

Fso.DeleteFile(AP & "\Start Menu\Windows Catalog.lnk")

Fso.DeleteFile(Wd & "\System32\$winnt$.inf")

Fso.DeleteFile(SD & "\GmanSilentCUP.VBS")

TO Test Copy And Paste These In The Run Box Below Here

cmd.exe /c Mkdir %systemdrive%\Installcmd.exe /c Mkdir %systemdrive%\Drivers
TO Test Copy And Paste These In The Run Box Above Here

I have updated this to include this file now $winnt$.inf

I Gunsmokingman give all users full permission to do what ever they want with this script.

SilentUaC.exe

Edited by gunsmokingman
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...