Jump to content

Recommended Posts

Posted

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

The 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?


Posted

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.

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

Posted

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.

Posted

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.

Posted

This Will Delete This File On Systemdrive

Red Is Where You Add The File Name To Be Deleted.

Dim Garbage

set Garbage = (CreateObject("Scripting.FileSystemObject"))

msgbox "Starting Clean UP?",vbokonly+48,"Clean Up"

Garbage.DeleteFile ("\RemoveActiveFile.vbs")

wscript.sleep 500

Delete=("\RemoveActiveFile.vbs")

wscript.sleep 500

msgbox "Clean UP Completed?",vbokonly+48,"Clean Up Those Files"

Posted

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

I 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 Garbage
set Garbage = (CreateObject("Scripting.FileSystemObject"))
Garbage.DeleteFile ("\final.exe")
Delete=("\final.exe")

Posted

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" /F

I could delete it up via runonce as well but... since it's a 60kb file in the temp folder it really makes no difference.

Posted (edited)

Here I Add A cmd that generates the cleanup vbs

This worked well on my computer

echo off 
cls
color f2
mode con: cols=55 Lines=3
Title 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.vbs
set /p = Press Key To Close

Edited by gunsmokingman
Posted

Great.. I got it to work. Had to modify it a bit though, here it goes.

Final.exe

REM PATH OF EXECUTABLE
SET FINAL=%SystemDrive%\Temp\Final.exe

REM COMMANDS
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\"
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

Posted

Why not just make it a .vbs from go to whoa?

On Error Resume Next
Dim Garbage, Shell, U, S
Set 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)

Posted

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...