Gagorian Posted December 28, 2004 Share Posted December 28, 2004 I use IExpress to turn my .cmd files into .exes so the commandwindows dont even pop up for a second. I place the final cleanup executable (Final.exe) into %AllUsersProfile%\Start Menu\Programs\Startup\ then on next startup it would run and then delete itself.The commandfile is as following:DEL "%UserProfile%\Desktop\Connect to the Internet.LNK"DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\Launch Internet Explorer Browser.lnk"DEL "%UserProfile%\Favorites\MSN.url"DEL "%UserProfile%\Favorites\Radio Station Guide.url"DEL "%UserProfile%\Favorites\Web Events.url"DEL "%UserProfile%\Favorites\MSN.com.url"RD /S /Q "%UserProfile%\Favorites\Links\"RD /S /Q "%UserProfile%\Favorites\Media\"DEL "%AllUsersProfile%\Start Menu\Programs\Startup\Final.exe"EXITThe delete command in the end doesn't work, probably since it's still running. After that I tried experimenting with Post-Install commands but didn't find one that would work. Suggestions? Link to comment Share on other sites More sharing options...
Incroyable HULK Posted December 28, 2004 Share Posted December 28, 2004 This one looks exactly like the problem I had HEREFinally, I decided to leave my Install folder in the %windir%\Temp location so I don't mind if it doesn't get deleted... Link to comment Share on other sites More sharing options...
Gagorian Posted December 28, 2004 Author Share Posted December 28, 2004 It's not exactly the same situation.. Since I want the Final.exe run one reboot after I remove the entire installation folder (with cleanup.cmd). That's why I put it in the Startup folder, I want to get it removed after it has run once.I guess I COULD use RunOnce and leave it to rot somewhere but... I'd like to see if I can get it working this way. Link to comment Share on other sites More sharing options...
MHz Posted December 28, 2004 Share Posted December 28, 2004 DEL "%UserProfile%\Desktop\Connect to the Internet.LNK"DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\Launch Internet Explorer Browser.lnk"DEL "%UserProfile%\Favorites\MSN.url"DEL "%UserProfile%\Favorites\Radio Station Guide.url"DEL "%UserProfile%\Favorites\Web Events.url"DEL "%UserProfile%\Favorites\MSN.com.url"RD /S /Q "%UserProfile%\Favorites\Links\"RD /S /Q "%UserProfile%\Favorites\Media\"Attrib -r "%AllUsersProfile%\Start Menu\Programs\Startup\Final.exe"DEL "%AllUsersProfile%\Start Menu\Programs\Startup\Final.exe"Maybe it is a read only attribute causing it to not self-delete. Added Attrib command and removed Exit. Link to comment Share on other sites More sharing options...
Gagorian Posted December 28, 2004 Author Share Posted December 28, 2004 Nope, the file isn't read-only.Just for clarification.. Final.cmd is actually the commands Final.exe runs (as in Final.cmd IS Final.exe) so it sort of instructs to remove itself, and apparently that does not work. Link to comment Share on other sites More sharing options...
sixpack Posted December 28, 2004 Share Posted December 28, 2004 ad echo's between your command'stry it Link to comment Share on other sites More sharing options...
Gagorian Posted December 28, 2004 Author Share Posted December 28, 2004 Didn't help unfortunately.The problem is that access is denied to delete the file when it's still running... so, I wonder how can I make it delete itself AFTER it has run. I'm still thinking it can be done through IExpress Post-Install commands, but can't really figure it out. Link to comment Share on other sites More sharing options...
gunsmokingman Posted December 28, 2004 Share Posted December 28, 2004 This Will Delete This File On SystemdriveRed Is Where You Add The File Name To Be Deleted.Dim Garbageset Garbage = (CreateObject("Scripting.FileSystemObject"))msgbox "Starting Clean UP?",vbokonly+48,"Clean Up"Garbage.DeleteFile ("\RemoveActiveFile.vbs")wscript.sleep 500Delete=("\RemoveActiveFile.vbs")wscript.sleep 500msgbox "Clean UP Completed?",vbokonly+48,"Clean Up Those Files" Link to comment Share on other sites More sharing options...
Gagorian Posted December 28, 2004 Author Share Posted December 28, 2004 If I run it manually it does delete files.. but if I use IExpress to call it after the install.. it says "Error creating process <C:\Temp\IXP000.TMP\Garbage.vbs>. Reason: age.vbsI have to experiment. Thanks.I stripped it down a bit... I'll see if I can get IExpress to run it in post-install..Dim Garbageset Garbage = (CreateObject("Scripting.FileSystemObject"))Garbage.DeleteFile ("\final.exe")Delete=("\final.exe") Link to comment Share on other sites More sharing options...
Gagorian Posted December 28, 2004 Author Share Posted December 28, 2004 I can't really find a solution.. so I simply have the following code in Cleanup.exe (IExpressed Cleanup.cmd for complete silence). COPY /Y "%systemdrive%\winapps\Final.exe" "%systemdrive%\Temp\"REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /V 1 /D "%systemdrive%\Temp\Final.exe" /FI could delete it up via runonce as well but... since it's a 60kb file in the temp folder it really makes no difference. Link to comment Share on other sites More sharing options...
gunsmokingman Posted December 29, 2004 Share Posted December 29, 2004 (edited) Here I Add A cmd that generates the cleanup vbsThis worked well on my computerecho off clscolor f2mode con: cols=55 Lines=3Title Test Remove Vbs > %Systemdrive%\CU1.vbs echo Dim Garbage>> %Systemdrive%\CU1.vbs echo set Garbage = (CreateObject("Scripting.FileSystemObject"))>> %Systemdrive%\CU1.vbs echo msgbox "Starting Clean UP?",vbokonly+48,"Clean Up">> %Systemdrive%\CU1.vbs echo Garbage.DeleteFile ("\CU1.vbs")>> %Systemdrive%\CU1.vbs echo wscript.sleep 500>> %Systemdrive%\CU1.vbs echo Delete=("\CU1.vbs")>> %Systemdrive%\CU1.vbs echo wscript.sleep 500>> %Systemdrive%\CU1.vbs echo msgbox "Clean UP Completed?",vbokonly+48,"Clean Up Those Files"start /w %Systemdrive%\CU1.vbsset /p = Press Key To Close Edited December 29, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
Gagorian Posted December 29, 2004 Author Share Posted December 29, 2004 Great.. I got it to work. Had to modify it a bit though, here it goes. Final.exeREM PATH OF EXECUTABLESET FINAL=%SystemDrive%\Temp\Final.exeREM COMMANDSDEL "%UserProfile%\Desktop\Connect to the Internet.LNK"DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\Launch Internet Explorer Browser.lnk"DEL "%UserProfile%\Favorites\MSN.url"DEL "%UserProfile%\Favorites\Radio Station Guide.url"DEL "%UserProfile%\Favorites\Web Events.url"DEL "%UserProfile%\Favorites\MSN.com.url"RD /S /Q "%UserProfile%\Favorites\Links\"RD /S /Q "%UserProfile%\Favorites\Media\"RD /S /Q "%systemdrive%\winapps\"REM DELETION> "%CD%garbage.vbs" echo Dim Garbage>> "%CD%garbage.vbs" echo set Garbage = CreateObject("Scripting.FileSystemObject")>> "%CD%garbage.vbs" echo Garbage.DeleteFile ("%FINAL%")>> "%CD%garbage.vbs" echo Garbage.DeleteFile ("%CD%garbage.vbs")START wscript.exe "%CD%garbage.vbs"After it has run, it deletes itself and the .vbs file also deletes itself. Nothing left, and completely silent. Sweet.Edit: Changed the code a bit Link to comment Share on other sites More sharing options...
nakira Posted December 29, 2004 Share Posted December 29, 2004 Why not just make it a .vbs from go to whoa?On Error Resume NextDim Garbage, Shell, U, SSet Shell = WScript.CreateObject("WScript.Shell")U = Shell.ExpandEnvironmentStrings("%UserProfile%")S = Shell.ExpandEnvironmentStrings("%SystemDrive%")Set Garbage = CreateObject("Scripting.FileSystemObject")Garbage.DeleteFile(U & "\Desktop\Connect to the Internet.LNK")Garbage.DeleteFile(U & "\Application Data\Microsoft\Internet Explorer\Quick Launch\Launch Internet Explorer Browser.lnk")Garbage.DeleteFile(U & "\Favorites\MSN.url")Garbage.DeleteFile(U & "\Favorites\Radio Station Guide.url")Garbage.DeleteFile(U & "\Favorites\Web Events.url")Garbage.DeleteFile(U & "\Favorites\MSN.com.url")Garbage.DeleteFolder(U & "\Favorites\Links")Garbage.DeleteFolder(U & "\Favorites\Media")Garbage.DeleteFolder(S & "\winapps")Garbage.DeleteFile(WScript.ScriptFullName) Link to comment Share on other sites More sharing options...
Gagorian Posted December 29, 2004 Author Share Posted December 29, 2004 Well. The reason I originaly had was that... I consider a commandfile easier to edit and add new entries. But come to think of it, I'm not going to edit it that often. Not a bad idea. Link to comment Share on other sites More sharing options...
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