You are not logged in. [Log In] KiXtart.org website » Forums » KiXtart » Basic Scripting » Copy to local drive then remove Register User       Forum List       Calendar       FAQ
 Page 1 of 1 1
 Topic Options
 #212314 - 17/03/02 10:27 PM Copy to local drive then remove Sweeny Fresh Scripter Registered: 16/03/18 Posts: 12 Loc: Hampshire To the good people of the Kixtart forum,I have a script which resides on a file share. For unrelated reasons that script needs to be run locally on the machine and can't be run from the file share. Could someone point me in the right direction to how I'd go about automatically copying the script to a temporary location on the local drive, letting it run then removing the script from the local machineMany thanks in advance,Tom Top
 #212317 - 17/03/03 12:04 AM Re: Copy to local drive then remove [Re: Sweeny] Allen KiX Supporter Registered: 03/04/19 Posts: 4209 Loc: USA If you are running it from the logon script it would be nothing more than something like the following.Copy the file to the %temp% directory.shell "%temp%\filename.exe"if you need to run it at a later time, scheduling it with Task Scheduler would be the way to go. Search the board. Top
 #212318 - 17/03/03 10:44 AM Re: Copy to local drive then remove [Re: Allen] Sweeny Fresh Scripter Registered: 16/03/18 Posts: 12 Loc: Hampshire Thank you for the advice Allen, I will see what I can get working. The script isn't run from a logon script, it is a standalone script that a technician has to manually run. The issue I am having is the technician not copying the script from the file server onto the local drive before instigating the script. To get round the issue I hoped I'd be able to code in the ability for the script to copy itself and run from the local version then delete itself. Or am I making this harder than it should be? (not unusual ) Many thanks,Tom Top
 #212319 - 17/03/03 11:38 AM Re: Copy to local drive then remove [Re: Sweeny] Mart KiX Supporter Registered: 02/03/27 Posts: 4590 Loc: The Netherlands What if you put the script in a folder with only read access for the people that need to run the script, copy it from there to a local drive, start it and afterwards delete it?Something like this?Completely untested but I am just trying to push you in the right direction. Code:Break on ? "Copying script to local drive and starting it. Standby...." $source = "\\server\share\script.kix"$destination = "C:\Folder\" Copy $source$destination $Shellline = "Kix32.exe " +$destination + "Script.kix" Shell $shellline Del$destination + "Script.kix"  _________________________ Mart- Chuck Norris once sold ebay to ebay on ebay. Top
 #212320 - 17/03/03 03:54 PM Re: Copy to local drive then remove [Re: Mart] Allen KiX Supporter Registered: 03/04/19 Posts: 4209 Loc: USA If you have sensitive information in the script you could also tokenize it. This would at least obscure the code from prying eyes. Top
 #212321 - 17/03/03 04:05 PM Re: Copy to local drive then remove [Re: Mart] ShaneEP MM club member Registered: 02/11/29 Posts: 1972 Loc: Tulsa, OK Maybe something like this? Code:If Left(@ScriptDir, 3) <> "C:\" ; NOT RUNNING FROM C:\ If Exist("%temp%\TempScript.kix") Del "%temp%\TempScript.kix" EndIf Copy @ScriptDir+"\"+@ScriptName "%temp%\TempScript.kix" Shell '\\server\share\path\to\wkix32.exe "%temp%\TempScript.kix"' Del "%temp%\TempScript.kix" Exit 0 EndIf Edited by ShaneEP (17/03/03 04:11 PM)Edit Reason: Forgot to delete the script after running Top
 #212322 - 17/03/03 04:27 PM Re: Copy to local drive then remove [Re: ShaneEP] Sweeny Fresh Scripter Registered: 16/03/18 Posts: 12 Loc: Hampshire Thank you everyone for the advice, I will test and hope for the best Top
 Page 1 of 1 1

Moderator:  Jochen, Allen, Radimus, Chris S., Glenn Barnas, ShaneEP, Arend_, Mart
 Hop to: KiXtart ------   Kixforms   KiXtart FAQ & How to's   Basic Scripting   COM Scripting   Suggestions   BetaRepository ------   KiXtart Learning
 Shout Box
 Who's Online 0 registered and 72 anonymous users online.
 Newest Members FredR, jhirche, MarcSant, Daniel_9_jr, Ralf_Mueller 17368 Registered Users

Generated in 0.047 seconds in which 0.016 seconds were spent on a total of 13 queries. Zlib compression enabled.

 Search the board with: superb Board Search or try with google: Web kixtart.org