Jump to content

load script into memory / avoid handle


Recommended Posts

Hi there,

i have a script wich runs from USB, sometimes i will remove the USB after the script is startet, actually i even want to remove it using the script itself.

But windows will refuse ejecting the USB since the script is running from it and there is an open handle.


The common "resolution" is to copy the script to $temp and re-run it from there, but i dont want to copy my script for security reasons and i dont like filling up $temp.


Is there another way to end the script's handle or even to preload it completely into memory?





Link to comment
Share on other sites

Don't know, but what about running it from temp and selfdelete on exit?

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

thanks for your ideas, but its not yet the solution


the batch is not the problem (you can use removedrive.exe or maybe devcon.exe), but as long the program runs from the same drive you cannot safely eject.

I also would avoid ejecting forcefully too often.


hmm deleting is an idea but "delete on exit" will not work in case the machine stops unexpected etc. etc.

deleting while its running is not possible normally


can i end the handle without stopping the program?

Edited by yasuo
Link to comment
Share on other sites

Perhaps if you could outline these security concerns, you might inspire a solution.

Not wanting to copy a file to a drive, but rather execute it in memory seems a little odd regarding security.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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