It looks like there might be problems with the way you combined your command line.
In addition, I had to access STDIN directly.
# 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
Compact version:
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\""
The last two lines are of type printf:
puts "winexe to host: %s" % host exec "echo winexe -U dmn1\\\\%s //%s \"cmd\"" % [myID, host]
The last two lines with concatenation plus:
puts "winexe to host: " + host exec "echo winexe -U dmn1\\\\" + myID + " //" + host + " \"cmd\""
The last two lines with the addition of C ++ style:
puts "winexe to host: " << host exec "echo winexe -U dmn1\\\\" << myID << " //" << host << " \"cmd\""
Sean Vikoren
source share