windowsにおいてsendtoからcygwin emacs22を起動する

以下を emacs.vbsとして C:\Documents and Settings\ユーザ名\SendTo\ に保存すると右クリック送るに登録することが出来る。

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExec  = objShell.Exec("C:\cygwin\bin\cygpath """+WScript.Arguments(0)+"""")
cygPath = objExec.StdOut.ReadLine
'WScript.Echo "C:\cygwin\bin\run.exe /bin/bash --login -c ""/usr/local/emacs/22.1/bin/emacs \"""+cygPath+"\"""""
objShell.Run("C:\cygwin\bin\run.exe /bin/bash --login -c ""/usr/local/emacs/22.1/bin/emacs \"""+cygPath+"\""""")

ついでにemacsclientを使う場合には以下。

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExec  = objShell.Exec("C:\cygwin\bin\cygpath """+WScript.Arguments(0)+"""")
cygPath = objExec.StdOut.ReadLine
'WScript.Echo "C:\cygwin\bin\run.exe /bin/bash --login -c ""/usr/local/emacs/22.1/bin/emacs \"""+cygPath+"\"""""
objShell.Run("C:\cygwin\bin\run.exe /bin/bash --login -c ""/usr/local/emacs/22.1/bin/emacsclient \"""+cygPath+"\""""")