Jump to content

Recommended Posts

Posted

Hi, I have a windows unattended CD, and all the applications install OK, but I want to delete the $Install folder on the C: Drive, I would like to know how I can run a script from my windows CD that will delete that folder. I tried one, but it won't delete the folder becasuse the script is running from that same folder.


Posted

Here a suggestion make a winrar sfx file, with this script in it.

This then extracts the script to your temp folder then it runs

the delete stuff.

Save as Cleanup.vbs

Dim Remove :Remove = "PLACE_PATH_TO_FOLDER_HERE"
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
WScript.Sleep 2000
If Fso.FolderExists(Remove) Then Fso.DeleteFolder(Remove)
Fso.DeleteFile(WScript.ScriptFullName)

Winrar SFX

;The comment below contains SFX script commands

Path=%Tmp%\
Setup=wscript.exe "%Tmp%\Cleanup.vbs"
Silent=1

This will delete the folder if it exists and then delete the script file in the temp folder.

Posted

how do I add the script to dhe SFX?

;The comment below contains SFX script commands

Path=%Tmp%\

Setup=wscript.exe "%Tmp%\Cleanup.vbs"

Silent=1

Posted

Save the script that I posted with the correct folder path.

Then right click the file, select add to archive

From there check the Create SFX archive

Then press the ok button

Then right click the new SFX file, select open with winrar

Select the comments button then paste the SFX code.

If you would post what you wanted cleanup with full paths.

I would make you a script and sfx for you to use

Posted

I would like to delete the folder C:\$Install, that my windows cd creates. So this is how I have my Cleanup.vbs

Dim Remove :Remove = "%systemdrive%\$Install"

Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")

WScript.Sleep 2000

If Fso.FolderExists(Remove) Then Fso.DeleteFolder(Remove)

Fso.DeleteFile(WScript.ScriptFullName)

The SFX code will be:

;The comment below contains SFX script commands

Path=%Tmp%\

Setup=wscript.exe "%Tmp%\Cleanup.vbs"

Silent=1

"wscript.exe"is the name of the SFX file

Posted (edited)
I would like to delete the folder C:\$Install, that my windows cd creates. So this is how I have my Cleanup.vbs

Dim Remove :Remove = "%systemdrive%\$Install"

Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")

WScript.Sleep 2000

If Fso.FolderExists(Remove) Then Fso.DeleteFolder(Remove)

Fso.DeleteFile(WScript.ScriptFullName)

The SFX code will be:

;The comment below contains SFX script commands

Path=%Tmp%\

Setup=wscript.exe "%Tmp%\Cleanup.vbs"

Silent=1

"wscript.exe"is the name of the SFX file

Rename the file wscript.exe is the name of a windows file.

Also you will have to add these line to the script.

Dim Fso	:Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Remove :Remove = Act.ExpandEnvironmentStrings("%systemdrive%\$Install")
WScript.Sleep 2000
If Fso.FolderExists(Remove) Then Fso.DeleteFolder(Remove)
Fso.DeleteFile(WScript.ScriptFullName)

Edited by gunsmokingman

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