Skip to content

Instantly share code, notes, and snippets.

@stknohg
Created May 2, 2017 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/9b57b117481f52bce741a87e7939fb64 to your computer and use it in GitHub Desktop.
Save stknohg/9b57b117481f52bce741a87e7939fb64 to your computer and use it in GitHub Desktop.
PowerShellコンソール上でruby -e を呼ぶあれやこれや
# これは文字列のエスケープで死ぬ
C:\Ruby23-x64\bin\ruby.exe -e 'puts "Hello World!"'
# 解析停止記号を使う - これなら死なない
C:\Ruby23-x64\bin\ruby.exe --% -e 'puts "Hello World!"'
# "をエスケープする - これなら死なない
C:\Ruby23-x64\bin\ruby.exe -e 'puts \"Hello World!\"'
# 気合で関数を作る - これも死なない
function ruby(){
$RubyPath = "C:\Ruby23-x64\bin\ruby.exe"
$RawArguments = $MyInvocation.Line.Replace($MyInvocation.MyCommand.Name,"").TrimStart()
Invoke-Expression "$RubyPath --% $RawArguments"
}
ruby -e 'puts "Hello World!"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment