This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Exerro's profile picture

finding the parent script

Started by Exerro, 13 January 2013 - 07:24 AM
Exerro #1
Posted 13 January 2013 - 08:24 AM
Im trying to get a program to copy itself to other programs …but it can be called anything so is there any way to find what the program the script is running from is called i.e. fs.open(script.parent,"r")
If you need to know im making a load of virusses to test my antivirus and this will be a part of the virus
remiX #2
Posted 13 January 2013 - 08:32 AM

thisProgramName = fs.getName(shell.getRunningProgram())

shell.getRunningProgram() returns the full path,
fs.getName() will make it return the last name
Exerro #3
Posted 14 January 2013 - 01:21 AM
ok thanks :D/> very useful