[erlang-questions] how to open_port with spaces in path?

Denis Bilenko <>
Sun Feb 11 19:26:11 CET 2007

I'm trying to execute external program which happened to have spaces in
path (not uncommon on windows). open_port exits with einval:

56> open_port({spawn, "D:/a a/my.exe"}, []).

=ERROR REPORT==== 11-Feb-2007::23:59:35 ===
Error in process <0.102.0> with exit value:
{einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval

** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},
                    {shell,eval_loop,3}]} **

I've tried to use quotes

57> open_port({spawn, "\"D:/a a/my.exe\""}, []).

it doesn't change anything.

Googling revealed this:
Known problems
  * os:cmd on WIN32 does not always catch the output from the executed program
    correctly. There is also a problem with executing programs with
space in the path.

It was not fixed? Are there any workarounds?

erl: 5.5.3
os: winxp


More information about the erlang-questions mailing list