Jump to content

IExpress executable deleting itself?


Recommended Posts

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?

Link to comment
Share on other sites


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

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

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

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)

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