Jump to content
Sign in to follow this  
MrBedo

Unable to delete Autoit compiled exe

Recommended Posts

MrBedo

So this is a really strange one. If I compile an AU3 file (using right-click menu), I can delete it, no problem.

However, if I run that exe from within a VMWare virtual machine as a different user (non admin) I can no longer delete the exe. Worse still, I can't edit the permissions on the exe or even take ownership. I should say that I'm a domain admin and have no problem taking over files and folders usually.

I cannot delete the file as the non-admin (VM) user either. The script from which the exe is compiled contains a 'RunAs' command and I cannot delete the exe using the account that command calls either.

The exe doesn't change location at any point during this process.

Can anyone shed any light on this behaviour?

thanks

Share this post


Link to post
Share on other sites
MrBedo

Shutting down the VM resulted in me being able to delete the exe. That suggests that the exe was bein held open but I'd already checked that it wasn't still runnign in the background. I hadn't used any 'wait' commands in the script either.

At least I know how to resolve it now, but I'm still at a loss to explain the behaviour.

Share this post


Link to post
Share on other sites
jchd

Could that be the effect of some AV program? Many of them behave strangely when detecting an AutoIt executable being accessed/run.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Rich071

MrBedo,  Not sure if this is the same as your issue since you did not mention using shared folders. But it's worth a shot.

I use shared folders a lot with the VM's. If you run an EXE from a shared folder on the Host, then close the EXE, the EXE will still be held by VMware. On the Host, unlock the file with Unlocker. You will see that the file is being held by vmware-vmx.exe. This is a known problem. Shutting down the VM, as you said, will also release the lock.

You can also create a batch file to auto unlock locked files with Unlocker. Run Unlocker with /? for all the command line options. A couple of common ones, are below.

/S - Unlock the files without showing the GUI

/L - Text file with list of files to unlock.

Hope this helps.

(Edited for spelling)

Edited by Rich071

Share this post


Link to post
Share on other sites
Rich071

Jscript,

Thanks for the link, however isn't this a just a little bit overkill, to delete a directory and all it's contents, when the original intent is to kill a single process in memory and delete one file?

I'm sure I will have later use for your script in a complete different scenerio.

Thanks,

Share this post


Link to post
Share on other sites
MikahS

:P just change the function from deleting a folder to a file..


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Rich071

I agree, changing to a filename would work. However, why reinvent the wheel, if you have Unlocker installed. It's there with a right click and also in my case, from a compiled batch file, that is in a Utils folder on the taskbar, in the Host, it is easy to get to. Yes, these could be added to a larger script to enhance it but that is a completely different scenerio.

Yes, I love Autoit, in fact, I have done some things, that I wouldn't be able to do without it. I consider it, "One of the best things since sliced bread", but unless I have a need to enhance and include these portions in a larger script or a script with more flexibility, I'd rather not reinvent the wheel.

An after thought, I do have a need for the folder deletion script on a project that I'm currently working on, inside a WinPE session. I will be testing that later today.

I do appreciate all the feedback.

Thanks,

Share this post


Link to post
Share on other sites
MikahS

To each their own @Rich071 :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
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
Sign in to follow this  

×