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

Floppy Disk >> Computer

Started by _mika99_, 28 August 2015 - 11:55 PM
_mika99_ #1
Posted 29 August 2015 - 01:55 AM
I am making an Installer for my own OS, and it's nearly done. One thing is missing: The actual installing. I got the startup file and a "Wundows 1" file on my Floppy Disk. I want the "Wundows 1" file to be the new startup file of the connected PC.

I would really apprechiate a quick answer. :)/>

~ Mika
KingofGamesYami #2
Posted 29 August 2015 - 02:11 AM
Assuming there is one disk drive connected to the computer, and the file in question is named "Wundows" (spaces will mess things up here!) you can use this:


>cp disk/Wundows startup
_mika99_ #3
Posted 29 August 2015 - 02:33 AM
Can't you use cp only in the Computer Console? I want to copy "Wundows" to the PC and rename it to "startup" after I did some things in the Floppy Disk-Startup. Sorry if I'm misunderstanding something, but I started with CC today and I don't have that much experience :)/>
HPWebcamAble #4
Posted 29 August 2015 - 06:17 AM
In the floppy disk's startup, you can add this line:


shell.run("cp disk/Wundows startup")
'shell.run' will execute the string you give it as if you'd run it in the computer's console.
Twijn #5
Posted 29 August 2015 - 06:48 AM
In the floppy disk's startup, you can add this line:


shell.run("cp disk/Wundows startup")
'shell.run' will execute the string you give it as if you'd run it in the computer's console.
That will try to run the program 'cp disk/Wundows startup', not 'cp' with the rest as arguments. It should be:

shell.run("cp","disk/Wundows","startup")
Bomb Bloke #6
Posted 29 August 2015 - 07:29 AM
That was true once; but quite some time ago, it was changed so that either format became acceptable.
_mika99_ #7
Posted 29 August 2015 - 02:22 PM
In the floppy disk's startup, you can add this line:


shell.run("cp disk/Wundows startup")
'shell.run' will execute the string you give it as if you'd run it in the computer's console.

Thenk you very much, this worked perfectly for me! :)/>
I tried shell.run before, but I didn't know it's syntax and i just forgot looking because it was 2AM.
But I'm writing too much, I'm just impressed, by the community in this forum. :)/>

Just thanks for the answer, I'm sure I will enjoy my stay in this forum! ^_^/>
Exerro #8
Posted 29 August 2015 - 05:30 PM
That was true once; but quite some time ago, it was changed so that either format became acceptable.

Expanding on this, shell.run() joins its arguments with a space, then splits them again, so each argument (mainly the first one) can contain a space and it is split correctly.

While using shell.run() is generally ok, you might want to use fs.move() instead. It works exactly the same, `fs.move( "disk/Wundows", "startup" )`, but doesn't rely on shell running a whole program that does the exact same thing.
Lyqyd #9
Posted 29 August 2015 - 06:12 PM
Rather, fs.copy instead of cp.
_mika99_ #10
Posted 29 August 2015 - 06:23 PM
Rather, fs.copy instead of cp.

I tried that before, but it didn't work, so I used shell.run. Works perfectly too.
But thanks for your answer. ^_^/>