Jump to content

How to delete install folder


Recommended Posts

I have been doing an unattended and after i do the install when i look in C:\ the install folder is still there even though i have this in the "start.cmd"

ECHO.

ECHO Deleting Temp Installation Files...

RD /S /Q %systemdrive%\Drivers

RD /S /Q %systemdrive%\install

Do i need to add something else.

Link to comment
Share on other sites


cumminbk, i tried using the quotes but the folders are still there after install. I caught a glimpse of a warning box as it flashed on screen but it went by to fast for me to read it.

Nilfred, were do i put these two lines, do they go in the start.cmd file. If so do i enter them exactly as you have written them.

Link to comment
Share on other sites

Here are parts of my cleanup relevant to what your asking. This is from my start.cmd that runs WPI and cleans up after install (basicly controls the whole UA process before and after WPI).

@echo off
SetLocal enableextensions
CLS

: Deleting TEMP files.
for /d %%g in ("%temp%\*") do rd /s /q "%%g"
for %%g in ("%temp%\*") do del /q "%%g"
for /d %%g in ("%windir%\Downloaded Installations\*") do rd /s /q "%%g"
for %%g in ("%windir%\Downloaded Installations\*") do del /q "%%g"
del /q "%Windir%\system32\$winnt$.inf"
rd /s /q "%SystemDrive%\Install"
rd /s /q "%SystemDrive%\Drivere"

: Reboot.
shutdown.exe -r -f -t 60 -c "Vennligst vent..."

: Delete the current running file (start.cmd).
del /q "%~f0"

EndLocal
exit
:eof

works every time, clean and simple :D

(I make sure that Start.cmd is copied to %SystemDrive%\ and not the %SystemDrive%\Install dir, therefore I can first remove ..:\install etc. and then reboot for lastly in the cmd to delete itself (start.cmd).)

Edited by BoardBabe
Link to comment
Share on other sites

Here is a VBS script that start a cmd session and deletes the VBS script

before the cmd session is finished. This is just to show the difference

between how a VBS script can delete it self with out errors.

Save As DeleteSelf.vbs

Dim Act,Fso

Set Act = CreateObject("Wscript.shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

Act.Run("%comspec% /c echo off && color f3 && mode 55,5 && title Test Delete && Echo." &_

"&& Echo Test Delete The VBS Is Gone && Echo %UserName% && echo %Date% && ping -n 5 127.0.0.1>nul")

Fso.DeleteFile("DeleteSelf.vbs")

Link to comment
Share on other sites

@qwerty1 if you want to see what error message you are getting replace Exit at the end of your batch file with Pause. This will force you to hit enter before the file will continune so you will be able to read your error message and figure out what exatly the problem is. good luck

Edited by cumminbk
Link to comment
Share on other sites

Thanks for the info all. gunsmokingman with this being my first go at an unattended install, im not understanding the things your saying and pointing me at. I need to give that link you first pointed me at a thorough reading. Now the second reply you made regarding "vbs" as below

Dim Act,Fso

Set Act = CreateObject("Wscript.shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

Act.Run("%comspec% /c echo off && color f3 && mode 55,5 && title Test Delete && Echo." &_

"&& Echo Test Delete The VBS Is Gone && Echo %UserName% && echo %Date% && ping -n 5 127.0.0.1>nul")

Fso.DeleteFile("DeleteSelf.vbs")

Were would i put this file and how would i adapt it for my purpose and were would it be called from.

BoardBabe, here is my start.cmd so you can see what ive done. I also moved my start.cmd out of the install folder as per your instruction.

CLS

@echo off

TITLE Windows XP SP2 - Semi-Unattended Installation

ECHO.

ECHO Over the next few minutes you will see automated installations

ECHO of various software applications, windows updates, and registry

ECHO tweaks being implemented. The computer will restart automatically

ECHO once the whole process has finished!

ECHO.

ECHO Starting installation of Applications

ECHO.

ECHO Installing Kerio Personal Firewall

start /wait %systemdrive%\install\kerio\kerio-kpf-4.2.2-911-win.exe /s /v"/qn REBOOT=1

ECHO.

ECHO Restarting the PC in 1 minute...

shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

ECHO.

ECHO Deleting Temp Installation Files...

RD /S /Q %systemdrive%\Drivers

RD /S /Q %systemdrive%\install

EXIT

Ive also tried using the following, using C:\ instead of %systemdrive% but still the folder dont get deleted.

ECHO.

ECHO Deleting Temp Installation Files...

rd /s /q C:\Drivers

rd /s /q C:\install

EXIT

I tried adding your clean up as follows

CLS

@echo off

TITLE Windows XP SP2 - Semi-Unattended Installation

ECHO.

ECHO Over the next few minutes you will see automated installations

ECHO of various software applications, windows updates, and registry

ECHO tweaks being implemented. The computer will restart automatically

ECHO once the whole process has finished!

ECHO.

ECHO Starting installation of Applications

ECHO.

ECHO Installing Kerio Personal Firewall

start /wait %systemdrive%\install\kerio\kerio-kpf-4.2.2-911-win.exe /s /v"/qn REBOOT=1

ECHO.

ECHO Restarting the PC in 1 minute...

shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

@echo off

SetLocal enableextensions

CLS

: Deleting TEMP files.

for /d %%g in ("%temp%\*") do rd /s /q "%%g"

for %%g in ("%temp%\*") do del /q "%%g"

for /d %%g in ("%windir%\Downloaded Installations\*") do rd /s /q "%%g"

for %%g in ("%windir%\Downloaded Installations\*") do del /q "%%g"

del /q "%Windir%\system32\$winnt$.inf"

rd /s /q "%SystemDrive%\install"

rd /s /q "%SystemDrive%\Drivers"

: Reboot.

shutdown.exe -r -f -t 60 -c "Vennligst vent..."

: Delete the current running file (start.cmd).

del /q "%~f0"

EndLocal

exit

But the folders still remain. I also took out

ECHO.

ECHO Restarting the PC in 1 minute...

shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

But it made no diference. by the way what is WPI, is it an install assistant.

cumminbk, i tried using pause but no errors are showing. Ive tried that many things that its hard to remember which files i altered when i got the error box i mentioned.

Heres whats happening with my install, at the end if it when i get the first logon screen and i login it gets as far as applying your personal settings then the pc reboots automatically, and if im correct there has already been one reboot immediately prior to this. The first reboot happens after the install of the app below and i think this reboot has something to do with the problem im having. Here,s my thoughts on it

I think things seem to go wrong after the install of kerio although it installs ok. Even though ive added switches for a silent instal with no reboot. It looks like the no reboot is being ignored and i think its this reboot causing the problem. Are the lines ive put in my install of kerio correct to surpress a reboot.

Edited by qwerty1
Link to comment
Share on other sites

Try this it a self extracting SFX file that will clean up some short cuts and remove

the Install and driver folder.

Silent Ua Clean Up

Place it in the same spot to where you install the app from in your UA CD.

Then add a entry to your RunOnce some thing like this

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

REG ADD %KEY%\170 /V 1 /D "%CDROM%Apps\SilentUaC.exe" /f

This is what the VBS script looks like in the SFX file.

Red Do Not change unless you know what you are doing

Some directoy locations

Action that the script performs

Files or folders that get deleted

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")

This was just a example of differences between VBS and CMD, it was to show that

you can delete the VBS file while a Cmd that it start is still running

Dim Act,Fso

Set Act = CreateObject("Wscript.shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

Act.Run("%comspec% /c echo off && color f3 && mode 55,5 && title Test Delete && Echo." &_

"&& Echo Test Delete The VBS Is Gone && Echo %UserName% && echo %Date% && ping -n 5 127.0.0.1>nul")

Fso.DeleteFile("DeleteSelf.vbs")

Link to comment
Share on other sites

gunsmokingman, thanks for your time and effort. I downloaded the SFX but i havnt got a "RunOnce" other than a entry in the winnt.sif file "GuiRunOnce". I tried putting the reg lines you suggested in there but i couldnt load from the iso got an error box saying line 47 wrong. I tried other variations but the files still remained after install. All through this testing i was becoming more and more certain Kerio was the cause of the problem, which has turned out to be the case. This was how i originally had the line written in start.cmd for installing Kerio

ECHO.

ECHO Installing Kerio Personal Firewall

start /wait %systemdrive%\install\kerio\kerio-kpf-4.2.2-911-win.exe /s /v"/qn REBOOT=1

Kerio would install but ignored the no reboot and this seemed to end the start.cmd before the clean up could be run. I swopped the line and also the version of Kerio to install to

ECHO.

ECHO Installing Kerio Personal Firewall

start /wait %systemdrive%\install\kerio\kerio-kpf-4.2.0-785-win.exe / S /V\"/qn REBOOT=Supress\"

I know get a dialogue box containing the following during the Kerio install

command line perameters

/L language ID

/S hide initiallization dialog. For silent mode use /S/v/qn

/V parameters to msiexec.exe

/ua <ur toinstmsia.exe>

/ua <url to msi package>

At the bottom of this box is a single confirmation box containing OK

After pressing OK things carry on and after reboot Kerio is not installed but the good news is that after putting this original entry back in my start.cmd file

ECHO.

ECHO Deleting Temp Installation Files...

RD /S /Q %systemdrive%\Drivers

RD /S /Q %systemdrive%\install

These folders along with the start.cmd file are deleted. So the problem definately centres round the Kerio install. I just need to get the switches right for it. I will do another search here and see what i turn up.

Link to comment
Share on other sites

war59312, im ok with the clean up thing now ive had it working. Kerio,s the problem. Ive tried loads of different switches ive found from searches here. With some, Kerio installs but my start.cmd gets terminated before it does the clean up, with others Kerio doesnt install and start.cmd runs. I tried the one you posted

For Kerio try just /qn REBOOT=Suppress

But i got the box with various switches and ok to click at the bottom and Kerio didnt install, the install and driver folders were deleted though.

Link to comment
Share on other sites

Finally managed to get the Kerio problem sorted, it now installs without any help from me and after install the start.cmd carries on and deletes required folders and itself. Thanks again the help everyone. Here is the switch i used its a modified version of one i found here

ECHO.

ECHO Installing Kerio Personal Firewall

start /wait %systemdrive%\install\kerio\kerio-kpf-4.2.0-785-win /S /V"/qn REBOOT=Suppress\"

What could be a bonus is that Kerio appears to have been installed with advanced user selected.

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