Jump to content
Sign in to follow this  
Kunal

Self destructing app - one time use

Recommended Posts

Kunal

Hi I have the below script which makes a shortcut then copys it to a network area.

What i would like to do is when it copys the shortcut over and after i run the program for which the shortcut is for, the shortcut needs to delete itself and make sure that a local copy of the program does not get cached for security reasons. How can i do this? temp files maybe?

$comp_name = InputBox("What's the computer name?", "Please provide Computer Name?")

If Not $comp_name = "" Then
    FileCreateShortcut(@ProgramFilesDir & "\MyProgram\file.exe", @ScriptDir & "\file.lnk", @ProgramFilesDir & "\MyProgram")
    FileCopy(@ScriptDir & "\file.lnk", "\\" & $comp_name & "\c:\Documents and Settings\All users\Desktop")
EndIf

Share this post


Link to post
Share on other sites
Baloven

Shared disk c: in Network c$

CODE
FileCopy(@ScriptDir & "\file.lnk", "\\" & $comp_name & "\c$\Documents and Settings\All users\Desktop")

Share this post


Link to post
Share on other sites
Kunal

Shared disk c: in Network c$

CODE
FileCopy(@ScriptDir & "\file.lnk", "\\" & $comp_name & "\c$\Documents and Settings\All users\Desktop")

thanks but how does this delete the shortcut when you have finished with the program.

Share this post


Link to post
Share on other sites
mikiutama

Func OnAutoItExit ()...EndFunc

Defines a user-defined function that will be called when the script exit.

Opt("OnExitFunc", "OnAutoItExit")

Func OnAutoItExit()
    FileDelete("\\" & $comp_name & "\c$\Documents and Settings\All users\Desktop\file.lnk")
EndFunc

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  

×