27 posts
Posted 15 July 2012 - 10:23 PM
OK, So bassically, I'm making a program and I have a lot of PC's I want to install it on,
but the thing is, I don't want to type is all out over and over, so I thought why not an "install" disk?
where I'd put a drive next to the console, put the disk in, and it would overwrite the startup with new code for my program, how would I accomplish the editting of startup within a program? Many thanks!
1604 posts
Posted 15 July 2012 - 10:30 PM
Take a look at the fs api, specifically fs.copy.
Then just put the program in the disk and make the startup copy it to the computer.
Note: when using fs.copy, if the destination file already exists it will throw an error. You have to check if the file exists, and delete it before copying.
351 posts
Posted 16 July 2012 - 03:04 PM
I think the even easier solution is to just use shell.run("copy", "disk/file", "startup")
1604 posts
Posted 16 July 2012 - 03:44 PM
Yes, but he said overwrite, and copy throws an error if the file exists.
797 posts
Posted 16 July 2012 - 04:48 PM
for the install try using this code as the startup code on the disk (its quite easy tbh)
Spoiler
if fs.exists("startup") then
fs.delete("startup")
fs.copy("programname", "startup")
else
fs.copy("programname", "startup")
end
the only problem with this is that i have found fs.delete sometimes says action not allowed or something
146 posts
Location
the Netherlands
Posted 17 July 2012 - 12:02 AM
for the install try using this code as the startup code on the disk (its quite easy tbh)
Spoiler
if fs.exists("startup") then
fs.delete("startup")
fs.copy("programname", "startup")
else
fs.copy("programname", "startup")
end
the only problem with this is that i have found fs.delete sometimes says action not allowed or something
shorter:
Spoiler
if fs.exists("startup") then
fs.delete("startup")
end
fs.copy("disk/file", "startup")
Does the same, just shortened it up