ऐसा लगता है कि आप अपनी कमांड स्ट्रिंग को एक साथ कैसे डाल रहे थे, इस तरह की समस्या हो सकती है।
इसके अलावा, मुझे सीधे एसटीडीआईएन का संदर्भ देना पड़ा।
# Minimal changes to get it working:
print "enter myid: "
myID = STDIN.gets
myID = myID.downcase
myID = myID.chomp
print "enter host: "
host = STDIN.gets
host = host.downcase
host = host.chomp
print "winexe to host: ",host,"\n"
command = "echo winexe -U dmn1\\\\#{myID} //#{host} \"cmd\""
exec command
कॉम्पैक्ट संस्करण:
print "enter myid: "
myID = STDIN.gets.downcase.chomp
print "enter host: "
host = STDIN.gets.downcase.chomp
puts "winexe to host: #{host}"
exec "echo winexe -U dmn1\\\\#{myID} //#{host} \"cmd\""
अंतिम दो printf शैली के साथ लाइनों:
puts "winexe to host: %s" % host
exec "echo winexe -U dmn1\\\\%s //%s \"cmd\"" % [myID, host]
अंतिम दो के साथ लाइनों के साथ साथ स्ट्रिंग संयोजन:
puts "winexe to host: " + host
exec "echo winexe -U dmn1\\\\" + myID + " //" + host + " \"cmd\""
अंतिम दो C++ शैली संलग्न के साथ लाइनों:
puts "winexe to host: " << host
exec "echo winexe -U dmn1\\\\" << myID << " //" << host << " \"cmd\""
स्रोत
2011-11-16 21:47:17
आप किस वर्ग को 'कमांड' होने की उम्मीद करते हैं? –