System ' cmd ' -call to run aws-s3 cli commands ends with error 127

Please quote code correctly on the forum:

EDIT: Thanx

You don’t need a temporary VBS file to run a command on Windows.
Instead use the Windows Scripting Host via Ruby’s WIN32OLE class:

def run_cmd(cmd)
  require 'win32ole' unless defined?(WIN32OLE)
  WIN32OLE.new("WScript.Shell").Run(cmd.gsub('”', '“”'), 0)
end

… although I do not understand what your are doing with gsub and the smartquote characters.