LLiLo Posted March 27, 2008 Posted March 27, 2008 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.
gunsmokingman Posted March 27, 2008 Posted March 27, 2008 Here a suggestion make a winrar sfx file, with this script in it.This then extracts the script to your temp folder then it runsthe delete stuff.Save as Cleanup.vbsDim 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 commandsPath=%Tmp%\Setup=wscript.exe "%Tmp%\Cleanup.vbs"Silent=1This will delete the folder if it exists and then delete the script file in the temp folder.
LLiLo Posted March 27, 2008 Author Posted March 27, 2008 how do I add the script to dhe SFX?;The comment below contains SFX script commandsPath=%Tmp%\Setup=wscript.exe "%Tmp%\Cleanup.vbs"Silent=1
gunsmokingman Posted March 27, 2008 Posted March 27, 2008 Save the script that I posted with the correct folder path.Then right click the file, select add to archiveFrom there check the Create SFX archiveThen press the ok button Then right click the new SFX file, select open with winrarSelect 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
LLiLo Posted March 27, 2008 Author Posted March 27, 2008 I would like to delete the folder C:\$Install, that my windows cd creates. So this is how I have my Cleanup.vbsDim 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 commandsPath=%Tmp%\Setup=wscript.exe "%Tmp%\Cleanup.vbs"Silent=1"wscript.exe"is the name of the SFX file
gunsmokingman Posted March 27, 2008 Posted March 27, 2008 (edited) I would like to delete the folder C:\$Install, that my windows cd creates. So this is how I have my Cleanup.vbsDim 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 commandsPath=%Tmp%\Setup=wscript.exe "%Tmp%\Cleanup.vbs"Silent=1"wscript.exe"is the name of the SFX fileRename 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 March 28, 2008 by gunsmokingman
LLiLo Posted March 27, 2008 Author Posted March 27, 2008 It's not working, i have on WPI to run the SFX and it still doesnot deletes de $install folder
gunsmokingman Posted March 28, 2008 Posted March 28, 2008 It does not work from the sfx also, but I tried just the script by it self and it removed the folder.
LLiLo Posted March 28, 2008 Author Posted March 28, 2008 i will try running the script once the WPI installation is finished. I'll let you know if it works.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now