Kunal Posted November 22, 2007 Share Posted November 22, 2007 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 Link to comment Share on other sites More sharing options...
Baloven Posted November 22, 2007 Share Posted November 22, 2007 Shared disk c: in Network c$CODEFileCopy(@ScriptDir & "\file.lnk", "\\" & $comp_name & "\c$\Documents and Settings\All users\Desktop") Link to comment Share on other sites More sharing options...
Kunal Posted November 22, 2007 Author Share Posted November 22, 2007 Shared disk c: in Network c$CODEFileCopy(@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. Link to comment Share on other sites More sharing options...
mikiutama Posted November 22, 2007 Share Posted November 22, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now