WindowsのRubyで全てのgemをアンインストールする方法

コマンドプロンプトに以下のコマンドを貼り付けると全てのgemをアンインストールできます

ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.empty? }"


RubyInstaller(Ruby 1.9.3-p429) でインストールした場合は初期状態で以下のgemが入っているので、一からやり直したいときはRubyごと再インストールした方がいいかもしれないです

C:\>gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)