Skip to content

Instantly share code, notes, and snippets.

@ThorstenHans
Created July 21, 2011 09:35
Show Gist options
  • Save ThorstenHans/1096854 to your computer and use it in GitHub Desktop.
Save ThorstenHans/1096854 to your computer and use it in GitHub Desktop.
Ruby is sexy :)
class CommandLineExecuter
def self.execute(cli,props = {},nameless_param)
parameters = props.collect { |key,value| "/#{key}=#{value}" }.join " "
exec("#{cli} #{nameless_param} #{parameters}")
end
end
#Sample usage
CommandLineExecuter.execute "notepad"
CommandLineExecuter.execute "cmd", {:T=> "0A"}
CommandLineExecuter.execute "msbuild", {:Configuration => "Relese", :Platform => "AnyCPU"}, "myproject.csproj"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment