So, I can open files from the shell using ruby with system("start filename")
. However, when the file has a space on it, it doesn't work, even though I add the escape \
, or if I use shellescape.
Apparently one method would be to first obtain the 8.3 short name of the file, but tried this and didn't succeed. Does anybody knows how can I simply escape a space in this situation? My current code looks like this:
require 'shellwords'
filename = "#{$filenamewithspaces}.docx".shellescape
system("start #{filename}")
Thanks a lot!